[thelist] SQL Query Question

Joshua Olson joshua at waetech.com
Mon Apr 15 15:03:00 CDT 2002


----- Original Message -----
From: "Means, Eric D" <eric.d.means at boeing.com>
Sent: Monday, April 15, 2002 3:51 PM
Subject: RE: [thelist] SQL Query Question


> [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]

I don't think I like this answer, but I got this to work:

SELECT Min(tblFOO.name), Min(tblFOO.phone)
FROM tblFOO, tblBAR
WHERE tblFOO.phone <> tblBAR.phone
GROUP BY tblFoo.id
HAVING Count(name) = 2

I can try to explain offlist why this seems to work, but I don't want to put
my foot in my mouth later.

-joshua





More information about the thelist mailing list