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

Home -> Community -> Usenet -> c.d.o.misc -> Re: query trigger

Re: query trigger

From: Daniel Morgan <damorgan_at_exxesolutions.com>
Date: Tue, 20 May 2003 15:49:51 -0700
Message-ID: <3ECAB10F.1FDC2BCD@exxesolutions.com>


andrewst wrote:

> Originally posted by Daniel Morgan
> > The ORDER BY in an in-line view accomplishes what?
> >
> > I mean other than wasting CPU.
> > --
> >
> Er... it gets the result that was asked for? It may not be relationally
> pure, but it happens to work:
>
> SQL> select deptno, sumsal from
> 2 (
> 3 select deptno, sum(sal) sumsal
> 4 from emp
> 5 group by deptno
> 6 order by sumsal desc
> 7 )
> 8 where rownum = 1
> 9 /
>
> DEPTNO SUMSAL
> ---------- ----------
> 20 10875
>
> 1 select deptno, sumsal from
> 2 (
> 3 select deptno, sum(sal) sumsal
> 4 from emp
> 5 group by deptno
> 6 )
> 7* where rownum = 1;
>
> DEPTNO SUMSAL
> ---------- ----------
> 10 8750
>
> With the ORDER BY you get the dept with the highest sumsal; without,
> you don't.
>
> I'm surprised you didn't know that - or at least check it out before
> making sarcky comments ;)
>
> --
> Posted via http://dbforums.com

As opposed to using MAX?

Like I said ... other than wasting CPU.

--
Daniel Morgan
http://www.outreach.washington.edu/extinfo/certprog/oad/oad_crs.asp
damorgan_at_x.washington.edu
(replace 'x' with a 'u' to reply)
Received on Tue May 20 2003 - 17:49:51 CDT

Original text of this message

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