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_at_news.oracle.com>
Date: Thu, 13 Mar 2003 10:43:50 -0800
Message-ID: <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.