that looks promising. I'll have a go. Thanks.
SQL seems to be (for me at least) a different way of thinking - sort of like the
having to think differently when programing in PROLOG as opposed to pascal. I
guess it's just time and practice.
Phil.
"Kerry Sainsbury" <[EMAIL PROTECTED]> on 03/11/99 13:25:46
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
select name from example where attributeid = 5
and name in ( select name from example where attributeid = 11 )
----- Original Message -----
From: <[EMAIL PROTECTED]>
To: Multiple recipients of list database <[EMAIL PROTECTED]>
Sent: Thursday, November 04, 1999 10:20 AM
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