时间:2021-07-01 10:21:17 帮助过:22人阅读
删除多余的记录
delete from news WHERE (title IN (SELECT title FROM news GROUP BY title HAVING (COUNT(title) > 1))) AND (id NOT IN (SELECT MIN(id) AS nid FROM news GROUP BY title HAVING (COUNT(title) > 1)))
使用min的原因是保留发布时间最早的记录,如果要保留时间最后发布的可以使用max
MsSql去掉重复记录
标签:tle color font where width 重复记录 sel group let