IM具有我的查詢一點語法問題(簡化):甲骨文JOIN USING +子查詢:ORA-00904字符串:無效標識符
select *
from table1 t1
inner join table2 t2 using (pk1)
inner join table3 t3 using (pk2)
where not exists (select1 from table4 t4 where t4.pk1 = t1.pk1)
通過使用 「使用」 關鍵字時,oracle犯規允許在表標識符列名的前面(如:t1.pk1,只有PK1可以使用)
如果我寫:
select *
from table1 t1
inner join table2 t2 using (pk1)
inner join table3 t3 using (pk2)
where not exists (select1 from table4 t4 where t4.pk1 = pk1)
這個查詢將不會產生預期的結果。
但由於我使用的是「存在」子查詢,我怎樣才能加入這個子查詢?
當然,我想我可以用另一種方式寫這個查詢,避免存在,或者我不能使用「使用」。
但是有可能在where子句中將「連接/使用」與子查詢結合在一起?
編輯:使用Oracle 10gR2
事實上,這是要做到這一點,而不完全避免使用的唯一方法(我個人更喜歡堅持JOIN..ON而不是使用)。 – 2009-11-26 04:11:52