How do I update a table to remove orphaned references to a second
table? I've deleted rows in the second table, which has a unique
auto_increment key. The first table now has references to keys that no
longer exist. I need to update the first table, setting the value to
NULL where the referenced key no longer exists. Something like:
UPDATE table1 SET table2ID = NULL WHERE table1.table2ID NOT FOUND IN
table2.ID;
The NOT FOUND IN isn't SQL, of course, but I'm not sure what should go
there.
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/my***********...ie.nctu.edu.tw