Oracle JOIN USING子查询:ora-00904字符串:无效的标识符
发布时间:2021-01-17 09:46:01 所属栏目:站长百科 来源:网络整理
导读:我的查询中有一点语法问题(简化): select *from table1 t1inner join table2 t2 using (pk1)inner join table3 t3 using (pk2)where not exists (select1 from table4 t4 where t4.pk1 = t1.pk1) 通过使用“using”关键字,oracle不允许在列名前面使用表标识
我的查询中有一点语法问题(简化): 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) 通过使用“using”关键字,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子句中将“join / using”与子查询结合使用? 编辑:使用Oracle 10gR2 解决方法有趣的问题!我仍然使用USING时可以管理的最好的是:select * from ( select * from table1 t1 inner join table2 t2 using (pk1) inner join table3 t3 using (pk2) ) v where not exists (select1 from table4 t4 where t4.pk1 = v.pk1) (编辑:晋中站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |