我試圖在SQL中連接三個表。 我使用下面的查詢,但它不工作sql中的左右連接
select *
from char_level as c1 right join (SELECT distinct character_id as fid, target_character_dbid as tid FROM house
where reason='set_house_access' or reason='remove_house_access' and character_id is not null and target_character_dbid is not null)as vd on c1.character_id==vd.fid left join char_level as c2 on c2.character_id==vd.tid
誰能幫助?
查詢不執行:錯誤ORA-00933:SQL命令不能正確地結束 00933. 00000 - 「SQL命令不能正確地結束」 *原因: *動作: 行錯誤:38列: 17 – 2013-05-13 20:39:02
我期望結果應該是包含c1.account_id,vd.fid,vd.tid,c2.accoutn_id – 2013-05-13 20:40:10
的單個表Oracle對於表別名中的'AS'關鍵字有反感。刪除它(除了其他更正,在答案。)'從char_level爲c1'應該從'char_level c1'和')作爲vd'應該變成:')vd' – 2013-05-13 21:08:49