一 查询数据库所有数据(包含不重复数据)
'select MIN(b.id) as min_id from stang_big_fagui
as b WHERE b.wangzhan="裁判文书网" group by b.title,b.author,b.pubtime;'
二 查询数据库所有重复数据(不包含单条数据)
select MIN(id) from stang_big_fagui
WHERE b.wangzhan="裁判文书网" group by title, author, pubtime having count(*)>1;
三 查询数据库每条数据重复了多少条
select MIN(id),count(id) from stang_big_fagui
WHERE wangzhan="裁判文书网" group by title, author, pubtime;
四 删除数据库中重复字段
DELETE from stang_big_fagui
where wangzhan="裁判文书网" AND id not in (SELECT a.c from(select MIN(b.id) as c from stang_big_fagui
b WHERE b.wangzhan="裁判文书网" group by b.title,b.author,b.pubtime) a);