I’m having an sql error that i can’t work out. I have to update a table with a couple of joins. I tried doing it without an “in” clause, but that didnt’ work. Now with the in clause, here’s the query I have:
UPDATE sc_module_architect
SET
item_name="Print Cover Price"
WHERE
item_id IN (
SELECT a.item_id
FROM sc_module_architect a
LEFT JOIN sc_module_architect_category_links l on l.item_id=a.item_id
LEFT JOIN sc_module_architect_category c on c.category_content_id=l.content_id
LEFT JOIN sc_content sc on sc.content_id=l.content_id
WHERE item_active=1
AND content_name LIKE "ed_abc_print%"
LIKE item_name LIKE "Cover Price%");
Now when running it I get the error
/* SQL Error (1093): You can't specify target table 'sc_module_architect' for update in FROM clause */
Can’t work out why this comes up. Any ideas? Mysql 5.5
You cant use table under update in subquery also simultaneously:
You need to follow below syntax:
Try below: