how to exclude data from other table?

vinzz

Registered User.
Local time
Today, 05:48
Joined
Apr 24, 2008
Messages
47
hello,

i'm having a problem with setting up a query that only needs to show data from one table that's not in the other one. I'll explain a little:

I have 2 tables (i've got more but this are the ones i need for this query) called tblUsr and tblGameUsr
In tblUsr i have 2 column called 'Id' (auto-nmbr) and 'Name' (txt)
In tblGameUsr i have 3 column called 'id' (auto-nmbr), 'Game_id' (numric) and 'Usr_Id' (numric)
'Usr-Id' is connected with the field 'id' in the table TblUsr
'Game-id' is connected to antoher table with gamedata
Now on my form i need to have a combobox with all the names from tblUsr but without the names that are already in the current game (tblGameUsr)
How can i exclude this users with a query?
 
Have you tried the unmatched query wizard?
 
yes i have, but it didn't help me out.
 
You might try something like the following SQL (substitute highlighted text with actual table/field names):
Code:
SELECT T1.[B][I]Name[/I][/B]
FROM [B][I]tblUsr[/I][/B] AS T1
WHERE T1.[B][I]Id[/I][/B] NOT IN (
    SELECT T2.[B][I]Usr_Id[/I][/B]
    FROM [B][I]tblGameUsr[/I][/B] AS T2
    WHERE T2.[B][I]Game_Id[/I][/B] = [[B][I]Current_Game_Id[/I][/B]]);
 

Users who are viewing this thread

Back
Top Bottom