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