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

Home -> Community -> Mailing Lists -> Oracle-L -> RE: help with query :)

RE: help with query :)

From: Regina Harter <rharter_at_emc-inc.com>
Date: Fri, 02 Jun 2000 09:56:26 -0700
Message-Id: <10516.107583@fatcity.com>


I think that is just coincidence. Try the select with the rownum < 3 and without the order by and I suspect you will get the same three rows. It's just because that table was loaded in ascending empno order and will (most often) be retrieved in the same order.

At 06:03 AM 6/2/00 -0800, you wrote:
>This_is_strange, because I have tried the following two queries on the Scott
>demo table Emp and it worked. Let's see what Yohans says from his
>experience.
>
>Regards,
>
>Aleem
>
>Following is the result from both queries.
>
>SELECT EmpNo FROM Emp ORDER BY EmpNo DESC
>EMPNO
>----------
> 7934
> 7902
> 7900
> 7876
> 7844
> 7839
> 7788
> 7782
> 7698
> 7654
> 7566
> 7521 In the second query
> 7499 In the second query
> 7369 In the second query
>
>SELECT EmpNo FROM Emp WHERE ROWNUM <= 3 ORDERY BY EmpNo DESC
>
>EMPNO
>----------
> 7521
> 7499
> 7369
>
>
> -----Original Message-----
> From: Serge Kosourikhin [mailto:kosour_at_braz.ru]
> Sent: 02 June, 2000 2:22 PM
> To: Multiple recipients of list ORACLE-L
> Subject: Re: help with query :)
>
> It _shuldn't_ work, because ROWNUM works before order by, not after.
>
> Serge Kosourikhin
> Oracle DBA
> JSC Bratsk Aluminium Plant
> ----- Original Message -----
> To: Multiple recipients of list ORACLE-L <ORACLE-L_at_fatcity.com>
> Sent: Friday, June 02, 2000 4:44 PM
>
>
> > I think excellent, It should work.
> >
>
>--
>Author: Abdul Aleem
> INET: abchaudhary-ho_at_beaconhouse.edu.pk
>
>Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
>San Diego, California -- Public Internet access / Mailing Lists
>--------------------------------------------------------------------
>To REMOVE yourself from this mailing list, send an E-Mail message
>to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
>the message BODY, include a line containing: UNSUB ORACLE-L
>(or the name of mailing list you want to be removed from). You may
>also send the HELP command for other information (like subscribing).
Received on Fri Jun 02 2000 - 11:56:26 CDT

Original text of this message

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