查找表中重复的行与删除表中重复的行

xiaoxiao2026-08-08  11

查找表中重复的行:

 

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)

 

转载请注明原文地址: https://www.6miu.com/read-5050865.html

最新回复(0)