Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> comp.databases.theory -> Re: Why using "Group By"

Re: Why using "Group By"

From: Mikito Harakiri <mikharakiri_at_ywho.com>
Date: Thu, 13 Mar 2003 10:43:50 -0800
Message-ID: <lp4ca.12$wV5.87@news.oracle.com>

"Mikito Harakiri" <mikharakiri_at_ywho.com> wrote in message news:3i4ca.10$wV5.124_at_news.oracle.com...
> > select max(sum(sal)) from emp
> >
> > is not the same as
> >
> > select max(sum(sal)) from emp
> > group by dept
>
> Trivially so, because second query won't run. Please ignore this message.

The observation is valid. Please ignore my "ignore" reply. select max(sum(sal)) from emp

group by deptno

The query uses inner agregate function together with group by, and then applies outer aggregate function. It could be expressed as

select max(ssal) from (

  select sum(sal) as ssal from emp

  group by deptno

)

of course. Received on Thu Mar 13 2003 - 12:43:50 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US