Excluding items from a linked table?

tangcla

Registered User.
Local time
Today, 13:00
Joined
Sep 8, 2008
Messages
35
[SOLVED] Excluding items from a linked table?

Hi,
So I'm trying to build a query here, and I know you can link fields in different tables to limit the results... but how do I link a field so that it is NOT in the list of results?

i.e. in TableA, there's a field "Requester name" with results a, b, c, d, ... x, y, z.
Then there's TableB, with a field "Name", that has b, d, z.

Can I link the two together, so that it excludes b, d and z, so my results will be a, c, e, f, g, ... w, x, y ?


I hope I make sense... :p
 
Last edited:
Something like this?

Code:
SELECT * 
FROM TableA 
WHERE ColA NOT EXISTS
                        (SELECT ColA 
                         FROM TableB);
 
wow, that was quick :D I was hoping I could slack off work a bit more until I got an answer...! haha.

Is it possible to do it in the design view at all? Or is it only in code? I'm not very confident in creating code :)


If it helps, the query is like this at the moment. The query has the two fields joined, but will show me the results which IS in table B.
Code:
SELECT [TableA].Status, [TableA].[PSR ID], [TableA].[Requester name], [TableA].[Created on], [TableA].[Business area], [TableA].[Charge code], [TableA].[Agreed cost], [TableA].Summary
FROM [TableB] INNER JOIN [TableA] ON [TableB].Name = [TableA].[Requester name];
 
First post updated, to make things slightly clearer - I hope.
 
I found out that there's a wizard function which does exactly what I was looking for... LOL
 

Users who are viewing this thread

Back
Top Bottom