But still need the ORDER BY (to get TOP 3), right? And then I guess it's implicit that the ROWNUM would operate against the intermediate file produced to order the result set, and not the source table for the command.
Bill
> > I'm not getting anywhere RTFM. Luckily, this isn't critical. > > > > 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. ;-) > > > -- > Derek > [excessive quoting removed by server]
©2004 Bill Arnold |