同一个id ,如何筛选出同时存在类型a和类型b的数据,如果只出现类型a或者类型b就不筛选出来,同时出现才出来
select id,count(1) coun from table
group by id
having coun>1
select * from 表 t1 where exists (select t2.id from 表 t2 where t1.id=t2.id group by 表 having(count(t2.id))>1)