select c_1,c_2 from t1
where exists
( select * from t2 where c_3='a' and t1.id=t2.id)
and not exists
(select * from t2 where c_4='b' and t1.id=t2.id)
where exists
( select * from t2 where c_3='a' and t1.id=t2.id)
and not exists
(select * from t2 where c_4='b' and t1.id=t2.id)
where id in (
(select id from t2 where c_3='a')MINUS
(select id from t3 where c_4='b'))
select c_1,c_2 from t1
where id in
(select id from t2 where c_3='a')
and id in
(select id from t3 where c_4='a')
和
select c_1,c_2 from t1
where id in
((select id from t3 where c_3='a')
union
(select id from t4 where c_4='b'))
这两个sql语句一样吗?
这个:
select c_1,c_2 from t1
where exists
( select * from t2 where c_3='a' and t1.id=t2.id)
and not exists
(select * from t3 where c_4='b' and t1.id=t3.id)