I get this error:
You can’t specify target table ‘wp_mail_queue’ for update in FROM
clause
Because of this query:
DELETE FROM wp_mail_queue
WHERE message_id = (SELECT message_id FROM wp_mail_queue ORDER BY id LIMIT 0, 1)
ORDER BY wp_mail_queue.id
LIMIT 100
And I suppose it results from the subquery. Replace DELETE with SELECT * and it returns exactly the entries that I want to delete. What I need is a way to rewrite this so that I won’t need to query wp_mail_queue in that subquery, or avoid the subquery entirely.
My thoughts went first to variables, if I could somehow assign the subquery to one and then use that?
Try: