mysql删除重复记录的例子
程序员文章站
2022-07-14 20:17:19
...
SELECT * FROM ip_one WHERE id NOT IN ( SELECT * FROM (SELECT MIN(id) FROM ip_one GROUP BY user_id )a )
DELETE FROM ip_one WHERE id NOT IN ( SELECT * FROM (SELECT MIN(id) FROM ip_one GROUP BY user_id )a )
mysql 5.1.4中SELECT * FROM (SELECT MIN(id) FROM ip_one GROUP BY user_id )a 别名是必须的,否则会报错。
上一篇: 第二章:linux常用快捷键和常用命令
下一篇: iptables命令详解