查询重复的记录
select * from
(select count(*) as xh,id from table
group by id) where xh>1查询不重复的记录
select * from
(select count(*) as xh,id from table
group by id) where xh=1
select * from
(select count(*) as xh,id from table
group by id) where xh>1查询不重复的记录
select * from
(select count(*) as xh,id from table
group by id) where xh=1
改
select count(*) as xh,id into #a from table
group by id查询重复的记录
select * from
#a
where xh>1查询不重复的记录
select * from
#a where xh=1
不过补充一点
select * from
(select count(*) as xh,id from table
group by id) as a //不加 as a 会出错
where xh>1解决了,揭帖