实例!
说明: guest库的tt表中有两个字段id和mobile, mobile字段中有重复的内容,目的删除重复的内容(重复的内容要留一个).
处理的结果如下:
使用的sql server 语句是
delete from guest.tt where id NOT IN (select max(id) as id from guest.tt WHERE mobile in (select mobile from guest.tt group by mobile HAVING COUNT(1) > 1) group by mobile ) and mobile in ( select mobile from guest.tt group by mobile HAVING COUNT(1) > 1 )
转载于:https://blog.51cto.com/denglz/1354101