l********0 发帖数: 283 | 1 表是这样的:
id2 id3
1 1
1 2
1 3
2 1
2 3
3 2
4 1
4 2
我想查询这样的数据,就是同时满足id3=x和id3=y的id2
比如id3=1同时id3=2的id2有1,4
比如id3=1同时id3=3的id2有1,2
请问这条语句如何写(mysql)?谢谢! | c*****d 发帖数: 6045 | 2 select a.id2
from
(select * from tabA where id3=x) as a,
(select * from tabA where id3=y) as b
where a.id2=b.id2 | l********0 发帖数: 283 | 3 perfect, thanks a lot.
【在 c*****d 的大作中提到】 : select a.id2 : from : (select * from tabA where id3=x) as a, : (select * from tabA where id3=y) as b : where a.id2=b.id2
|
|