I'm trying to figure out an efficient way to join tables and cross reference with another table, with the reference looking to check that each record found in the join does not have a field which exists in the other table.
This is what I have so far - I somehow need to be able to make sure that each record's reg_no is not present in the buyers table (basically before an automated email is sent). Grateful for any pointers - anything that saves me having to iterate through each record and do an individual lookup!
SELECT * FROM (`owners`, `buyers`)
JOIN `records` ON (`records`.`pa_no` = `owners`.`contact_no`)
WHERE email <> "" AND `buyers`.reg_no <> `records`.reg_no