How do I workaround this error ? You can't specify target table my table for update in FROM clause
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 remov开发者_运维技巧ing the aliases, but that doesn't help :(
EDIT - Richard, screen shot
Update pads
set RemoveMeDate = '1999-01-01 00:00:00'
where padid in (SELECT padid FROM
( 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') a)
精彩评论