XOR two tables in MySQL

SELECT ot.id FROM old_table ot LEFT JOIN new_table nt ON ot.id=nt.id WHERE nt.id IS NULL

Only return that which they don't have in common.
Another way of saying it is only return where they do not intersect.

There are many Boolean operations that can be performed on sets.

Here is a list of examples, including the "exclusive-or" (XOR) operation:

http://geoportal.icimod.org/UserFiles/Image/capacity%20building/elearning/Figure%207_1.jpg

 
source:
http://geoportal.icimod.org/UserFiles/Image/capacity%20building/elearning/Figure%207_1.jpg
 
 
 

comments powered by Disqus