[thelist] SQL Query Question

Means, Eric D eric.d.means at boeing.com
Mon Apr 15 14:52:01 CDT 2002


[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)
[/snip]

What you need to do is return all the rows, then filter out the ones that
have no match in the exclusion table.

SELECT tblFOO.name, tblFOO.phone
FROM tblFOOR OUTER JOIN tblBAR
ON (tblFOO.phone = tblBAR.phone)
WHERE tblBAR.phone IS NULL

(something like that; not tested)



More information about the thelist mailing list