由于种种原因,不能够使用exists.请问:
select table1.* from table1 where exists (select 1 from table2 where table1.A=table2.A and table1.B=table2.B and table2.C<>'N')
如何转化成非exists语句?谢谢。
select table1.* from table1 where exists (select 1 from table2 where table1.A=table2.A and table1.B=table2.B and table2.C<>'N')
如何转化成非exists语句?谢谢。
select table1.* from table1 where exists (A,b) in (select a,b from table2 where table2.C <>'N')
(
select table1.*,table2.A as sign
from table1,table2
where table1.A = table2.A
and table1.B = table2.B
and table2.C <> 'N'
)C
where C.sign is not null
(select 1 from table2 where table1.A=table2.A and table1.B=table2.B and table2.C <>'N')
因为某些特定环境不支持exists,希望大家能理解。
and楼上的好像都行不通(或者语法有错,或者结果不等价), 希望各位再给我一些建议。1楼的gg能这么写吗?