Duplicate records in a delete table using MySQL
Delete from the user where username in (select the User name form (select username from the user group by username have count (usernam e) (>1));
Encounter MySQL error you can ' t specify target table to update in FROM clause
Internet Baidu is the original MySQL is not allowed to select out some values in the same table, and then update the table (in the same statement), this problem only occurs in Mysql,sqlserver and Oracle does not occur this problem
Workaround: Pass the result of the select again through the intermediate table select again
Delete from the user where username in (the Select A.username from (select username from the user group by username have count (Userna Me) (>1) a);
So the delete and select are not the same table.
MySQL in your can ' t specify target table for update in FROM clause