Home > 整站程序 > ecms 后台查询重复标题有几千个,怎样一次性删除

ecms 后台查询重复标题有几千个,怎样一次性删除

在phpmyadmin中输入如下语句
DROP  TABLE  IF  EXISTS  newstemp1;
CREATE  TEMPORARY  TABLE  
newstemp1(id  VARCHAR(10),title  VARCHAR(250))  TYPE=HEAP;
insert  into  newstemp1(id,title)  select  max(b.id),b.title  from  phome_ecms_news  a  ,  phome_ecms_news  b  where  a.title=b.title  and  a.id!=b.id  group  by  b.title;
delete  phome_ecms_news  a  from  phome_ecms_news  a,newstemp1  b  where  a.title=b.title  and  a.id!=b.id;

Categories: 整站程序 Tags:
  1. No comments yet.
  1. No trackbacks yet.
Note: Commenter is allowed to use '@User+blank' to automatically notify your reply to other commenter. e.g, if ABC is one of commenter of this post, then write '@ABC '(exclude ') will automatically send your comment to ABC. Using '@all ' to notify all previous commenters. Be sure that the value of User should exactly match with commenter's name (case sensitive).