MySQL non-matching Records

Problem: Finding records in Table b that do not match records in Table a

This sort of problem may arise when you need to scrub a file against another or run a duplicate scan on a file against another to weed out any duplicates that may exist prior to doing whatever it is you need to do with that file. Lets assume that both the tables have a field called “PHONE” that identifies your clients as unique.
The query that you will need to run uses LEFT JOIN function

SELECT * FROM TableB b
LEFT OUTER JOIN TableA a ON b.`PHONE` = a.`PHONE`
WHERE a.`PHONE` IS NULL

This should do it.

  • Share/Bookmark

Leave a Reply

You must be logged in to post a comment.