select [号段] from test group by [号段] having count(1) > 1
declare @sql table (a int ,b int ) insert @sql select 1352525,2 union all select 1352521,4 union all select 1352522,5 union all select 1352523,2 union all select 1352525,7 select * from @sqlselect * from @sql where a in (select a from @sql group by a having count(1)>1)
libin_ftsafe(子陌红尘:当libin告别ftsafe) 正解
select * from tablename group by 号段 having count(号段) > =2
from test
group by [号段]
having count(1) > 1
insert @sql
select 1352525,2 union all
select 1352521,4 union all
select 1352522,5 union all
select 1352523,2 union all
select 1352525,7
select * from @sqlselect * from @sql where a in (select a from @sql group by a having count(1)>1)
group by 号段
having count(号段) > =2