How to use mysql select out the results directly update the table

DELETE FROM t1 WHERE name in ( SELECT name from (select * from t1) as a)


mysql select results do not support the same sql statement, update or delete the same table. So to achieve this requirement is necessary to check out the results specify a new table name. here:


SELECT name from (select * from t1)

The formation of a new derived tables, each derived table must set an alias.


Guess you like

Origin blog.51cto.com/14028890/2424541