Click to See Complete Forum and Search --> : How to make a limit on query return?


Unna
04-02-2001, 11:26 AM
I try to select query an output that will limit the number or records returned, such as 10, how do I make such query?

Oracledba8
04-02-2001, 11:58 AM
Just at the End add
Where Rownum <= 10

Hope it will work.
Thanks

Unna
04-02-2001, 12:04 PM
Thanks, it works!

JGolightly
04-03-2001, 09:34 AM
Be careful with this if you're using an order by clause.

e.g. select * from emp
where rownum <= 10
order by emp_no

will return the first 10 rows and then sort them by emp_no.

It will not sort the data before selecting 10 rows.