2
People I have problem with this query do not know what is wrong:
DELETE FROM mdl_forum_discussions WHERE id IN
(
SELECT mdl_forum_discussions.id
FROM mdl_forum_discussions
LEFT JOIN mdl_forum_posts ON mdl_forum_discussions.id = mdl_forum_posts.discussion
WHERE mdl_forum_discussions.id = 4
);
Returns this error:
#1093 - You can’t specify target table 'mdl_forum_discussions' for update in FROM clause
What problem? Do not delete what needed? an exception ? put what is the problem too so it gets half Generic.
– Jhonatan Jorge de Lima
Add more information, which error is returning, the subquerie alone is working?
– Kenny Rafael
Possible duplicate of Update with Select
– Sorack