统计一个表里title 重复的

admin 2018-3-12 2933

Select title,Count(*) From ucms_article Group By title Having Count(*) > 1


欢迎联系本站长QQ:3216572
最新回复 (3)
  • admin 2018-3-22
    2楼
    delete from ucms_article
    where id not in(
    select * from (select max(id) from ucms_article group by title
    ) as tmp);


  • admin 2018-3-22
    3楼
    ALTER  TABLE  `ucms_article`  ADD  unique(`title`);


  • admin 2018-7-23
    4楼
    delete from ucms_article where title not in ( select * from (select max(title) from ucms_article group by title having count(title)>1) b);


返回
发新帖
作者最近主题: