我的
sql语句是:delete from ec_core_userthread as m,(select ID from ec_core_userthread group by user_code having count(*)>1) as n where m.user_code = n.user_code and m.id > n.id
但是执行是会说语法错误,求高手帮忙看看!需求是:我的ec_core_userthread表中存在user_code重复的数据,我想把重复的数据去除了。。

解决方案 »

  1.   

    delete m from ec_core_userthread as m left join (select ID from ec_core_userthread group by user_code) as n on m.user_code = n.user_code where n.user_code is null
      

  2.   

    delete from ec_core_userthread as m,(select *,min(id) from ec_core_userthread group by user_code having count(*)>1) as n where m.user_code = n.user_code and m.id > n.id这样写有啥为题?
      

  3.   

    delete from ec_co
    delete from e
      

  4.   

    create table aaaa as select max(c.pkid) id from tb_contact c group by c.UserID;
    delete from tb_contact where pkid not in (select id from aaaa); 
    drop table aaaa;
      

  5.   

    create table aaaa as select max(c.pkid) id from tb_contact c group by c.UserID;
    delete from tb_contact where pkid not in (select id from aaaa); 
    drop table aaaa;
      

  6.   

    delete m from ec_core_userthread as m left join (select ID from ec_core_userthread group by user_code) as n on m.user_code = n.user_code where n.user_code is null
    你的这个句子执行报错呀!我使用这个句子,他将没有重复的给删除了!这个应该怎么改呀?
    delete m from ec_core_userthread as m left join (select id,user_code,count(*) c from ec_core_userthread group by user_code having c >1) as n on m.user_code = n.user_code where n.user_code is null;
    求教!
      

  7.   

    delete m from ec_core_userthread as m left join (select ID from ec_core_userthread group by user_code) as n on m.ID = n.ID where n.ID is null