Select rows in table A that are not in table B
From Hashmysql
How do I select all rows in table `a` that is not in table `b`:
SELECT a.id FROM a LEFT JOIN b ON a.id = b.aid WHERE b.aid IS NULL;
As "SELECT a.id" simply decides which fields will be output this will work just as well:
SELECT * FROM a LEFT JOIN b ON a.id = b.aid WHERE b.aid IS NULL;