How do I workaround this error ? You can't specify target table my table for update in FROM clause
Posted
by
Jules
on Stack Overflow
See other posts from Stack Overflow
or by Jules
Published on 2011-01-09T09:19:42Z
Indexed on
2011/01/09
9:53 UTC
Read the original article
Hit count: 212
mysql
I'm struggling to convert my select query into a update query, it has aliases..
Update pads set RemoveMeDate = '1999-01-01 00:00:00' where padid in (
SELECT old_table.padid
FROM `jules-fix-reasons`.`pads` AS old_table
JOIN `jules`.`pads` AS new_table ON old_table.padid = new_table.`PadID`
WHERE new_table.RemoveMeDate <> '2001-01-01 00:00:00'
AND old_table.RemoveMeDate = '2001-01-01 00:00:00')
I've tried removing the aliases, but that doesn't help :(
© Stack Overflow or respective owner