原帖由 糕手 于 2011-4-13 16:31 发表 
查询相应表单,然后根据文章标题(这个重复文章看你定义是什么,一般定义是标题),查询,相同的 删除
我首先查询满足两个字段title和content,就被视为重复文章.
select * from piao_post a
where (a.title,a.content) in (select title,content from piao_post group by
title,content having count(*) > 1)
然后只保留pid最小值,但报错,语句我看了很多遍都没错啊.但就是报错.
delete from piao_post a
where (a.title,a.content) in (select title,content from piao_post group by
title,content having count(*) > 1)
and pid not in (select min(pid) from piao_post group by title,content having
count(*)>1)
[ 本帖最后由 11qq 于 2011-4-13 16:51 编辑 ] |