[thelist] SQL Query Question

Joshua Olson joshua at waetech.com
Mon Apr 15 13:15:01 CDT 2002


----- Original Message -----
From: "Jay Blanchard" <jay.blanchard at niicommunications.com>
Sent: Monday, April 15, 2002 2:01 PM
Subject: [thelist] SQL Query Question


> Can this be done?
>
> SELECT this, that, theother
> FROM tblFOO
> WHERE theother <> to a list of items from tblBAR

If you may not have sub-select capability, perhaps we can do a join instead,
throwing in a GROUP BY to remove repetition.

SELECT Min(tblFOO.this), Min(tblFOO.that), Min(tblFOO.theother)
FROM tblFOO
INNER JOIN tblBAR
      ON tblFOO.theother <> tblBAR.field
GROUP BY tblFOO.pk

Something to that effect.

The Min's are added to satisfy the parsers need for aggregate functions in
the select column because of the GROUP BY, but should have no effect on what
is actually selected because the GROUP BY is on the Primary Key.

HTH,

-joshua





More information about the thelist mailing list