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: Bob Badour <bbadour_at_golden.net>
Date: Thu, 13 Mar 2003 14:40:19 -0500
Message-ID: <jC5ca.63$hO2.8318076@mantis.golden.net>


"Mikito Harakiri" <mikharakiri_at_ywho.com> wrote in message news:lp4ca.12$wV5.87_at_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.

On a system that requires logical identity, the same query would simply be:

select max(ssal) from ( select deptno, sum(sal) as ssal from emp ) Received on Thu Mar 13 2003 - 13:40:19 CST

Original text of this message

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