17,090
社区成员
发帖
与我相关
我的任务
分享
select a1,a2,a3 from mytab a
where a2 in (select a2 from mytab where a3='a')
and a2 in(select a2 from mytab where a3='b')
and a2 not in(select a2 from mytab where a3='c')
select a1,a2,a3 from mytab a
where exists (select 1 from mytab where a2=a.a2 and a3='a' and a3='b')
and not exists (select 1 from mytab where a2=a.a2 and a3='c');
select * from A where A2 not in (select A2 from A where A3='c') and A2 in (select A2 from A WHERE A3='a' and A3='b');