Phil,
Try
select Name from Table
where AttributeID in (5, 11)
group by Name
Dennis.
> -----Original Message-----
>
> Hi, I have a tricky SQL problem (you may have guessed that
> from the subject
> heading :) that is beyond my SQL ability. And it only
> involves one table.
>
> Here is a simplified example table:
>
> Name AttributeID
>
> Bob 5
> Bob 3
> Bob 11
> Jim 5
> Jim 7
> Alice 8
> Alice 5
> Alice 11
>
> Basically, a person can have any number of attribute ID's
> (possibly even the
> same one twice). The query goes something like this: "Find me
> all the names that
> have records for AttributeID 5 and for AttributeID 11" where
> the 5 and the 11
> will change depending on what the user is searching for. The
> example query only
> required 2 attributeID's to exist, but there is in fact no limit.
>
> I'm guessing that some kind of tricky sub-query or exists
> clause is needed but
> every time I try and formulate it it escapes me.
>
> Phil.
>
>
> --------------------------------------------------------------
> -------------
> New Zealand Delphi Users group - Database List -
> [EMAIL PROTECTED]
> Website: http://www.delphi.org.nz
>
---------------------------------------------------------------------------
New Zealand Delphi Users group - Database List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz