1、问题
mysql> delete from tablename where tid in (select tid from tablename group by `tid` having count(*) > 1); ERROR 1093 (HY000): You can't specify target table 'tablename' for update in FROM clause 错误的大致意思是不能在同一语句中先select出同一表中某些值,再update这个表。
2、分析及解决方法
mysql> delete from tablename where tid in (select temp.tid from (select tid from tablename group by `tid` having count(*) > 1) temp);