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: andrewst <member14183_at_dbforums.com>
Date: Wed, 21 May 2003 09:10:44 +0000
Message-ID: <2905131.1053508244@dbforums.com>

Originally posted by Daniel Morgan
> 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/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"]http://www.outreach.washington.edu/extinfo/certprog/oad/oad_crs-
> .asp[/url]
> damorgan_at_x.washington.edu
> (replace 'x' with a 'u' to reply)

Please demonstrate and prove your point. What is your equivalent query using MAX, and what is the performance difference.

Put up or shut up!

--
Posted via http://dbforums.com
Received on Wed May 21 2003 - 04:10:44 CDT

Original text of this message

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