Re: Help: a challanege SQL request
From: Robert Klemme <shortcutter_at_googlemail.com>
Date: Tue, 28 Jun 2011 22:19:27 +0200
Message-ID: <96uralFc1qU1_at_mid.individual.net>
On 28.06.2011 21:50, charles wrote:
> All,
>
> I have a table like this:
> COL1 COL2
> ------------------------------
> I a
> I b
> I c
> II a
> II b
> III a
> III b
> III c
>
>
> I would like to get all the col1 that data entry is the same as I.
>
> So in this case, I has a, b, c, and III has a, b, c as well. I would
> like to get III, but II.
>
> Could somebody help?
Date: Tue, 28 Jun 2011 22:19:27 +0200
Message-ID: <96uralFc1qU1_at_mid.individual.net>
On 28.06.2011 21:50, charles wrote:
> All,
>
> I have a table like this:
> COL1 COL2
> ------------------------------
> I a
> I b
> I c
> II a
> II b
> III a
> III b
> III c
>
>
> I would like to get all the col1 that data entry is the same as I.
>
> So in this case, I has a, b, c, and III has a, b, c as well. I would
> like to get III, but II.
>
> Could somebody help?
Is this some kind of homework assignment? I would join the table with an inline view which selects all COL2 where COL1 is "I". Group the result by COL1 and select only those having a particular count. Roughly. Note, there is a premise which is needed for this to work properly. Left as exercise... ;-)
Kind regards
robert
-- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/Received on Tue Jun 28 2011 - 15:19:27 CDT