Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select emails in one table that aren't in the other table

Status
Not open for further replies.

charlie12345

Technical User
Mar 4, 2001
28
US
I'm sure this is simple, but I've never worked with two tables before. I'm trying to find all occurences where an email is in one table, and not the other.

Any suggestions or direction to some online help would be appreciated.

Charlie

 
The manual has a good lightweight introduction to databases and SQL
but you would need to dig a little deeper than the tutorial section in the manual to get the answer

select
a.email
from table1 a left join table2 b using(email)
where b.email is null;

This will give you a list of all emails in table1 that are not in table2
 
select t1.* from t1
left join t2 on t1.email = t2.email
where t2.email is null
 
Thanks.
I thought it was a Join with 'is null', but I was missing something.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top