SQLTeam.com | Weblogs | Forums

SQL Query involving two tables


#1

Hello All,

I am wondering how to make a query between two tables, which each contain a serialnum column. In plain English I would describe the query as...

select records from table1
where there is a serialnum that is not present anywhere in table2

Can anyone help me this?

Thank you,
Aaron


#2

You can use NOT EXISTS for this:

SELECT ...
FROM Table1
WHERE NOT EXISTS (SELECT NULL FROM Table2 WHERE Table1.Column1 = Table2.Column1)


#3

thank you, worked like a charm :slight_smile: