27,580
社区成员
发帖
与我相关
我的任务
分享
select * from tb t where exists (select 1 from tb where B1 = t.B1 and A1 <> t.A1)
--或者
select * from tb where B1 in (select B1 from tb group by B1 having count(B1)>1)
select * from tb t where exists (select 1 from tb where B1 = t.B1 and A1 <> t.A1)
select *
from tb t
where 1 < (select count(*) from tb where B1 = t.B1)
-- try !
select *
from tb
where B1 in (select distinct B1 from tb group by B1 having count(0) > 1)
select *
from tb t
where exists (select 1 from tb where B1 = t.B1 and A1 <> t.A1)