mysql数据库:
1,查询数据库表中 某个字段 的值 保存的记录是否 有多条重复。以 sens_sensitive 表 bbstitle 字段 标题为例
select fa.bbstitle,count(*) From sens_sensitive_bbs fa Group By fa.bbstitle Having count(*) > 1
2,删除该字段内重复 的多条数据,并保留 id 最大的那一条
DELETE a from sens_sensitive_bbs a,(select c.bbstitle,max(c.senstivebbsid) as bid from sens_sensitive_bbs c GROUP BY bbstitle HAVING COUNT(1) >1) b where a.bbstitle = b.bbstitle and a.senstivebbsid < b.bid;