Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL
Nope. This won't work. ROWNUM is assigned before ORDER BY, so you get the
first 3 rows found, sorted.
Gary O'Keefe <gary_at_onegoodidea.com> wrote in message
news:3795cec6.103845285_at_news.hydro.co.uk...
>
> Using Oracle (and why not, this is comp.databases.oracle.misc):
>
> SELECT *
> FROM emp
> ORDER BY salary DESC
>
> and for the second example:
>
> SELECT *
> FROM emp
> WHERE rownum <= 3
> ORDER BY salary DESC
>
> Tip: Get a copy of "ORACLE8: The Complete Reference" by George Koch
> and Kevin Loney (ISBN 0-07-88-2396-X, $59.99) from just about any book
> shop with a computing section. It's (IMO) the best and most complete
> Oracle book for a newbie, plus you'd never have asked the question if
> you'd read it.
>
> Tip 2: Don't you think that 8 question marks are a bit
> excessive???????? Don't you think that one on its own looks just a
> teensy bit more classy?
>
> Gary
> --
> Gary O'Keefe
> gary_at_onegoodidea.com
>
> You know the score - my current employer has nothing to do with what I
post
Received on Wed Jul 21 1999 - 09:46:33 CDT
![]() |
![]() |