select abc from table where abc in (select abc from table group by abc having count(*)>1 )
select abc from table1 where abc in (select abc from table1 group by abc having (count(*)>=2))
DECLARE @a table(name varchar(10)) INSERT INTO @a SELECT '你好' UNION ALL SELECT '我好' UNION ALL SELECT '他好' UNION ALL SELECT '大家好' UNION ALL SELECT '大家好' UNION ALL SELECT '大家好' SELECT * FROM @a Group By name having count(*)>1
select 表1.字段名 from 表1 a , 表1 b where a.字段名=b.字段名 group by a.字段名 having count(a.字段名) > 1
select abc as abc重复值 from 表名 where abc in (select abc from 表名 group by abc having count(*)>1 )
declare @t table(abc char(50)) insert @t select '你好' union all select '大家好' union all select '大家好' union all select '大家好' union all select '我好' union all select '他好' select b.abc from @t a left outer join (select abc from @t group by abc having count(abc)>1) b on a.abc=b.abc where b.abc is not null
INSERT INTO @a
SELECT '你好' UNION ALL
SELECT '我好' UNION ALL
SELECT '他好' UNION ALL
SELECT '大家好' UNION ALL
SELECT '大家好' UNION ALL
SELECT '大家好' SELECT * FROM @a Group By name having count(*)>1
from 表1 a , 表1 b
where a.字段名=b.字段名
group by a.字段名
having count(a.字段名) > 1
where abc in (select abc from 表名 group by abc having count(*)>1 )
insert @t
select '你好' union all
select '大家好' union all
select '大家好' union all
select '大家好' union all
select '我好' union all
select '他好'
select b.abc
from @t a left outer join (select abc from @t group by abc having count(abc)>1) b
on a.abc=b.abc
where b.abc is not null