删除表重复的列

来源:互联网 发布:jquery.min.js没有找到 编辑:程序博客网 时间:2024/05/18 01:55

小林需要一个需求,基本的思想是这样的

 比如说:
字段          id       title  
              1           张三  
              2           李四  
              3           张三  
              4           王五  
              5           李四  
   
   
  最终结果是  
              id       title  
              1         张三  
              2         李四  
              4         王五

 

 

偶给他想出来的方案是

 

create table tmp as select min(id) as col1 from blur_article group by title;
delete from blur_article where id not in (select col1 from tmp);
drop table tmp;

原创粉丝点击