I need to update the last 110 records of the relevo
table, however my problem is in the subquery in WHERE
.
I'm doing it this way:
UPDATE relevo
SET id_projeto = 157
WHERE id_relevo = (SELECT id_relevo FROM relevo
ORDER BY id_relevo DESC
LIMIT 110)
The following error is being returned:
You can not specify target table 'relief' for update in FROM clause
I also tried this way:
UPDATE relevo
SET id_projeto = ?
WHERE id_relevo IN (SELECT id_relevo FROM relevo
ORDER BY id_relevo DESC
LIMIT 110)
The error returned:
This version of MySQL does not support 'LIMIT & IN / ALL / ANY / SOME subquery