I'm trying to delete all rows from a table except the one having the max revision_id
value simultaneously selecting data from the same table:
delete from
node_revision__body
where
entity_id=4
and revision_id not in (
select
max(revision_id)
from
node_revision__body
where
entity_id=4
)
That throws the error
You can't specify target table 'node_revision__body' for update in FROM clause
Is it possible to somehow change the query in order to achieve the goal?