一、单表中数据去重

将重复的:user_code,user_name 的记录去掉  

delete * 
from  user
WHERE  del_flag = '0'  
and id NOT IN (
        SELECT MIN(id) AS id
        FROM  user
        where del_flag = '0'
        GROUP BY  user_code,user_name
  ) 
) 

原数据:
xxx, 小三,123123,123123,123,123,123
xxx, 小五,213123,12313,1232,123,234
xxx, 小六,123123,123123,123,123,123
xxx, 小三,123123,123123,123,123,123
xxx, 小六,123123,123123,123,123,123

结果:
xxx, 小三,123123,123123,123,123,123
xxx, 小五,213123,12313,1232,123,234
xxx, 小六,123123,123123,123,123,123





相关文章:

  • 2022-02-15
  • 2021-05-06
  • 2022-12-23
  • 2022-12-23
  • 2021-11-18
  • 2022-12-23
  • 2021-04-02
  • 2022-12-23
猜你喜欢
  • 2022-01-01
  • 2022-12-23
  • 2021-07-25
  • 2021-12-16
  • 2022-12-23
  • 2022-02-16
  • 2022-01-07
相关资源
相似解决方案