查找表中重复的行:
select * from tb_producttype where protname in
(select protname from tb_producttype group by protname having count(*)>1 )
删除表中重复的行:
delete from tb_producttype where id not in
(select max(id) from tb_producttype group by protname)
查找表中重复的行取唯一一条数据
select * from dbo.Y_author where a_id in
(select min(a_id) from dbo.Y_author group by A_name)