Path: text.usenetserver.com!out01b.usenetserver.com!news.usenetserver.com!in04.usenetserver.com!news.usenetserver.com!news.mixmin.net!news2.arglkargh.de!noris.net!news.odn.de!news-feed.eu.lambdanet.net!not-for-mail
Date: Sun, 09 Sep 2007 19:36:13 +0200
From: Jan Krueger <jk@stud.uni-hannover.de>
User-Agent: Thunderbird 2.0.0.6 (Windows/20070728)
MIME-Version: 1.0
Newsgroups: comp.databases.oracle.server
Subject: Re: GROUP BY clause
References: <1189196085.133917.279720@50g2000hsm.googlegroups.com>
In-Reply-To: <1189196085.133917.279720@50g2000hsm.googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 30
Message-ID: <46e42e82$0$29376$4c56b896@news-read1.lambdanet.net>
Organization: Lambdanet
NNTP-Posting-Date: 09 Sep 2007 17:33:54 GMT
NNTP-Posting-Host: 'L)M~…¼.news-read1.lambdanet.net
X-Trace: DXC=?]E5I1ZK02YcJQ72YClL?ZXl04NJR<Y^]gS=CF9eQ^kYASkKU=o\gC_j]`i30?Ebe_;hklGGIUTZ]YP[^XG?1:B_
X-Complaints-To: abuse@lambdanet.net
Xref: usenetserver.com comp.databases.oracle.server:434662
X-Received-Date: Sun, 09 Sep 2007 13:33:57 EDT (text.usenetserver.com)

brenda.beltran@gmail.com wrote:
> Hi everybody,
> 
> I just got to this area, so hope someone can help me with the
> following issue, I will really appreciate it.
> 
> I want to query a column that is not part of the GROUP BY clause:
> 
> SELECT c.country_id,
>               r.region_id,
>               r.manag_id,
>               SUM(r.sls),
>               SUM(r.cst)
> FROM country c INNER JOIN region r ON c.country_key = r.country_key
> GROUP BY c.country_id,
>               r.region_id;
> 
> Obviously, it's complaining because  r.manag_id  is not in the GROUP
> BY clause, but I need the result set to be as defined in the column
> clause. I wonder if there is any way to have these same columns in my
> query keeping  my GROUP BY clause as it is now.
Hi Brenda,

maybe I didn't get the point here, but I can't see the benefit of the 
inline view suggestions.
If you just add the r.manag_id as a third column to your group by 
clause, why is the resultset different from the one you expect?

Jan

