Joining 2 Tables

G

Guest

I have 2 tables: 'tblAssetCatLinkBackup012501' and 'tblAssetCatLink'. Both
tables have a field called 'asset'. I want to see which assets in the
'tblAssetCatLinkBackup012501' table are NOT in the 'tblAssetCatLink' table.
My query is below, but the 'NOT IN' in the WHERE clause is not working. Am I
writing this correctly?

Thanks for any help.


select asset
from tblAssetCatLinkBackup012501
where asset NOT IN (select asset from tblAssetCatLink);
 
G

Guest

It looks fine. If it is not giving the results that you are expecting,
another way of writing this query would be

SELECT T1.asset
FROM tblAssetCatLinkBackup012501 AS T1 LEFT JOIN tblAssetCatLink AS T2 ON
T1.asset = T2.asset
WHERE T2.asset IS NULL;

Hope This Helps
Gerald Stanley MCSD
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top