这个sql语句该怎么写(100分)

  • 主题发起人 主题发起人 foreachman
  • 开始时间 开始时间
F

foreachman

Unregistered / Unconfirmed
GUEST, unregistred user!
select a.*,b.* from rsbt_station a ,rsbt_freq c left outer join RSBT_ANTFEED b on b.station_guid=a.guid &nbsp;<br>&nbsp;where c.station_guid=a.guid and &nbsp; c.station_guid='1487e653-2b57-4724-b023-739ab1850d0f'<br>&nbsp; order by a.create_time desc
 
这句是错误的,该怎么写,求救!
 
select a.*,b.* from rsbt_station a <br>left join rsbt_freq c on a.guid = c.station_guid<br>left outer join RSBT_ANTFEED b on a.guid = b.station_guid<br>&nbsp;where c.station_guid='1487e653-2b57-4724-b023-739ab1850d0f'<br>&nbsp; order by a.create_time desc
 
楼上正解
 
恩,对头。
 
select rba.guid guid,ANT_Work_Type,ANT_POLE,ANT_RPOLE,ANT_EPOLE,ANT_TYPE,ANT_MODEL,ANT_MENU,to_char(ANT_HIGHT) ANT_HIGHT,to_char(ANT_GAIN) ANT_GAIN,to_char(ANT_EGAIN) ANT_EGAIN , <br>to_char(ANT_RGAIN) ANT_RGAIN,to_char(ANT_ANGLE) ANT_ANGLE,ANT_SIZE,FEED_MENU,FEED_MODEL,FEED_LENGTH,FEED_LOSE,AT_ANT_NO,to_char(AT_SE_B) AT_SE_B,to_char(AT_SE_E) AT_SE_E,AT_CCode,to_char(AT_3DBE) AT_3DBE,to_char(AT_3DBR) AT_3DBR,<br>to_char(AT_ANG_B) AT_ANG_B,to_char(AT_ANG_E) AT_ANG_E,AT_QUA,to_char(AT_BWID) AT_BWID,to_char(AT_LEL) AT_LEL,AT_SSPeed,AT_Sum,to_char(AT_ANT_UPANG) AT_ANT_UPANG<br>&nbsp;from rsbt_antfeed_t rsa ,Rsbt_antfeed rba<br>&nbsp;where station_guid='7bfa5ad6-ceec-433f-8fad-5c48bab05e18' and rba.guid=rsa.guid(+) 为什么去掉后面的+号查询就没数据了
 
这是因为去掉+号就是严格匹配,就是说检索的记录必须满足rba中的guid与rsa中的guid相等这个条件,可以改为:<br>select rba.guid guid,ANT_Work_Type,ANT_POLE,ANT_RPOLE,ANT_EPOLE,ANT_TYPE,ANT_MODEL,ANT_MENU,to_char(ANT_HIGHT) ANT_HIGHT,to_char(ANT_GAIN) ANT_GAIN,to_char(ANT_EGAIN) ANT_EGAIN , <br>to_char(ANT_RGAIN) ANT_RGAIN,to_char(ANT_ANGLE) ANT_ANGLE,ANT_SIZE,FEED_MENU,FEED_MODEL,FEED_LENGTH,FEED_LOSE,AT_ANT_NO,to_char(AT_SE_B) AT_SE_B,to_char(AT_SE_E) AT_SE_E,AT_CCode,to_char(AT_3DBE) AT_3DBE,to_char(AT_3DBR) AT_3DBR,<br>to_char(AT_ANG_B) AT_ANG_B,to_char(AT_ANG_E) AT_ANG_E,AT_QUA,to_char(AT_BWID) AT_BWID,to_char(AT_LEL) AT_LEL,AT_SSPeed,AT_Sum,to_char(AT_ANT_UPANG) AT_ANT_UPANG<br>&nbsp;from rsbt_antfeed_t rsa <br>left join Rsbt_antfeed rba on rsa.guid = rba.guid<br>&nbsp;where station_guid='7bfa5ad6-ceec-433f-8fad-5c48bab05e18'<br>结果是一样的。<br>结贴吧。
 
后退
顶部