nope,
that would look for single records where the attributeID = 5 and = 11 etc. That
is impossible so it would return an empty set.
Stacey Verner <[EMAIL PROTECTED]> on 03/11/99 15:36:23
Please respond to [EMAIL PROTECTED]
To: Multiple recipients of list database <[EMAIL PROTECTED]>
cc: (bcc: Phillip Middlemiss/NZ Forest Research Institute/NZ)
Subject: RE: [DUG-DB]: A tricky SQL problem
Isn't is just as follows where you need to produce a where clause and
for each attribute_id?
select name from example
where attribute_id = 5
and attribute_id = 11
and attribute_id = ??
Stacey Verner Ph: +64-9-4154790
Software Developer Fax: +64-9-4154791
CJN Technologies Ltd. Email: [EMAIL PROTECTED]
PO Box 302-278, North Harbour, Auckland, New Zealand
12 Piermark Drive, North Harbour Estate, Auckland, NZ
Visit our website at http://www.cjntech.co.nz/
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [SMTP:[EMAIL PROTECTED]]
> Sent: Thursday, November 04, 1999 10:20 AM
> To: Multiple recipients of list database
> Subject: [DUG-DB]: A tricky SQL problem
>
>
>
> 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
---------------------------------------------------------------------------
New Zealand Delphi Users group - Database List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz