main logo
Subject: RE: [NF] Equivalent of "Select TOP N" in Oracle?
Author: Vince Teachout
Posted: 2004/11/30 21:48:30
 
View Entire Thread
New Search


At 09:21 PM 11/30/04 -0500, Derek J. Kalweit wrote:

>> Would anyone happen to know how to do the equivalent of:
>>
>> "Select Top 3 Orders from MyTable Where Salesper = 'BOB'"
>>
>> but in Oracle? Doesn't seem to support any such device, and I can't
>> believe Oracle programmers are never called upon to give Top
>> 10 lists....
>
>I just happen to stumble through code today that did this... It's simply
>"rownum <= 3" in your where clause, where 3 is your limit. For example:
>
>SELECT * FROM Orders WHERE date > '2000-01-01' and rownum <= 3
>
>Someone else posted an URL, but I figured I'd burn it into the archives
>in case that site goes down someday and someone sees the question here
>without the actual solution. ;-)

Thanks, Derek! Then unnamed pbibro (at) onlineltc .D.OT com beat you to it by mere
seconds, but I appreciate both of your answers.



 
©2004 Vince Teachout
<-- Prior Message New Search Next Message -->