tanhaaiyaaN

Notes from the underground!

MySQL non-matching Records

Written By: tanhaa - Jun• 15•07

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

You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>