Sorry to bother you again but do you know how to create a join between two
tables and only pull off records which don't satisfy the join condition?
To illustrate, I created a test database which looks like the following:
Table1:
Table2:
Table3:
Table2 is to be viewed as a link table between Table1 and Table3. So if I
want to pull off all records which satisfy this link, I run
This produces as expected:
Now if I want to make the inverse query, namely one which looks like:
So I tried to do this query:
But I got a weird result:
So if I want to produce a query which looks like
Then what SQL code should I use?
Any help would be much appreciated.
tables and only pull off records which don't satisfy the join condition?
To illustrate, I created a test database which looks like the following:
Table1:
Code:
Key1 Name1 1 Adam
Code:
Key1 Key3 1 1 1 3
Code:
Key3 Name3 1 one 2 two 3 three 4 four
want to pull off all records which satisfy this link, I run
Code:
SELECT Table1.Name1, Table3.Name3 FROM (Table1 INNER JOIN Table2 ON Table1.Key1=Table2.Key1) INNER JOIN Table3 ON (Table2.Key3=Table3.Key3);
Code:
Name1 Name3 Adam one Adam three
Code:
Name1 Name3 Adam two Adam four
Code:
SELECT Table1.Name1, Table3.Name3 FROM (Table1 INNER JOIN Table2 ON Table1.Key1=Table2.Key1) INNER JOIN Table3 ON NOT (Table2.Key3=Table3.Key3);
Code:
Name1 Name3 Adam two Adam three Adam four Adam one Adam two Adam four
Code:
Name1 Name3 Adam two Adam four
Any help would be much appreciated.
Comment