[thelist] SQL Query Question

Jay Blanchard jay.blanchard at niicommunications.com
Mon Apr 15 14:45:01 CDT 2002


[snip]

--------------------------
|      tblFOO            |
--------------------------
| ID | Name | Phone      |
--------------------------
| 1  | John | 1115551212 |
| 2  | Jane | 2225551212 |
| 3  | Josh | 3335551212 |
| 4  | Joan | 4445551212 |
| 5  | Jake | 5555551212 |
--------------------------

--------------------------
|     tblBAR             |
--------------------------
| ID | ExemptPhone       |
--------------------------
| 1  | 1115551212        |
| 2  | 3335551212        |
--------------------------

When querying the two tables above we are looking to return;
--------------------------
| ID | Name | Phone      |
--------------------------
| 2  | Jane | 2225551212 |
| 4  | Joan | 4445551212 |
| 5  | Jake | 5555551212 |
--------------------------
[/snip]

Limited success.....doing the following returns the records that match;
(which IS NOT the info I want)

SELECT tblFOO.name, tblFOO.phone
FROM tblFOO INNER JOIN tblBAR
ON (tblFOO.phone = tblBAR.phone)

but doing the following returns all records in tblFOO

SELECT tblFOO.name, tblFOO.phone
FROM tblFOO INNER JOIN tblBAR
ON (tblFOO.phone <> tblBAR.phone)

Where, oh where I have gone wrong?

Signed, Moping on Monday

Jay





More information about the thelist mailing list