SQL删除表中多余的重复记录(多个字段),只留有id最小的记录
delete from jokes
where (title, author, content, url, next) in (select a.title, a.author, a.content, a.url, a.next from (select title, author, content, url, next from jokes group by title, author, content, url, next having count(*) > 1)a)
and id not in (select b.id from (select min(id) id from jokes group by title, author, content, url, next having count(*)>1)b)

浙公网安备 33010602011771号