当前位置:操作系统 > Unix/Linux >>

一条语句删除重复行


一条语句删除重复行
 
--可以检测到null列重复
 
delete from [JCXS0201] where 
 USER_ID in(select User_ID u from [JCXS0201] group by User_ID  having COUNT(id) >1 )
   and 
 id not in (select MIN(id) from [JCXS0201] where USER_ID in( select User_ID from  [JCXS0201] group by User_ID  having COUNT(id) >1   ) )
   www.zzzyk.com  
--不可以检测到null列重复
 
delete from [JCXS0201] where 
 USER_ID in(  select  User_ID u from [JCXS0201]  group by User_ID  having COUNT(id) >1  )
   and 
id not in (select MIN(id) from  [JCXS0201]  group by User_ID  having COUNT(id) >1  )
 
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,