Exlcuding data from SQL table in query
I may have been working too many hours lately, or I'm simply losing my mind, but I'm having a heck of a time with a very strange result from a query
I have a simple query that retrieves emails from a list
SELECT emaillist_email
FROM emaillist
Now let's say the above gives 50,000 records
Now take this
SELECT emaillist_block_email
FROM emaillist_block
Say that gives 5,000 records
Now put them together
SELECT emaillist_email
FROM emaillist
WHERE emaillist_email NOT IN
(
SELECT emaillist_block_email
FROM emaillist_block
)
Now unless I am losing it, I should get 45,000 records, presuming that the 5,000 are in both tables.
The issue is, I get zero records.
Any ideas?
*** I Have solved the problem after digging a little deeper. There was a NULL record in the data which had been imported from XLS causing it to throw the query out, once I removed it the correct records were returned ***
