If you try to run this query below in MySQL
UPDATE XXX SET count = count + 5000 WHERE id IN ( SELECT id FROM XXX WHERE id > 2 ) ;
You will get this error message:
“You can’t specify target table ‘XXX’ for update in FROM clause – MySQL …”
MySQL does have an unorthodox way to handle this type of request:
UPDATE XXX SET count = count + 5000 WHERE id IN ( SELECT id FROM ( SELECT id FROM XXX ORDER BY id DESC LIMIT 20 ) AS Temp_Tbl )