MySQL Forums
Forum List  »  Newbie

Trying to synchronize the rows in two tables...
Posted by: Jim Brunk
Date: February 19, 2011 09:15AM

I'm trying to synchronize the rows in two tables where 'code' is in a unique index (I've checked for duplicates). I can run:

SELECT table1.code
FROM table1 LEFT JOIN table2 ON table1.code = table2.code
WHERE table2.code IS NULL

But when I try to run the reverse:

SELECT table2.code
FROM table2 LEFT JOIN table1 ON table2.code = table1.code
WHERE table1.code IS NULL

nothing ever happens... no returned values, no error messages, nothing.

I was using MySQL version 5.0.45 on Mac OS X Server 10.5.8 when I first experienced the problem. I have now upgraded to MySQL version 5.1.55 and mysql_upgrade shows everything OK, but the problem still exists. Both directions work for some tables, but not for others.

Anybody know why the second statement won't work?

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.