22,209
社区成员
发帖
与我相关
我的任务
分享
select * from [tb] where [county] in(select [county] from tb group by [county] having count(*)>1)
觉得这个思路比较好--count
select * from [tb] where [county] in(select [county] from tb group by [county] having count(*)>1)
select * from tb a
where exists(select 1 from tb where name<>a.name and county=a.county)
select * from table1 as a where exists(select 1 from table1 where county=a.county and ID<>a.ID)
select * from table1 as a where exists(select 1 from table1 where county=a.county and name <>a.name )
select * from table1 as a where exists(select 1 from table1 where county=a.county and ID<>a.ID)