Any SQL gurus out there who can rewrite the following query:
UPDATE cmsTemplate
SET master = NULL
WHERE master IS NOT NULL
AND master NOT IN (SELECT nodeId
FROM
( SELECT * FROM cmsTemplate a) b
)
So that it does not produce the following error:
You can't specify target table 'cmsTemplate' for update in FROM clause
Issue documented here:
http://dev.mysql.com/doc/refman/5.6/en/update.html
Thanks, Steve
UPDATE: Description of query
The idea of the query is to do as follows:
- SET the master field TO NULL
- WHERE the master field IS NOT NULL
- AND WHERE the master field IS NOT EQUAL TO ANY of the values for the nodeId field records (within the same table)