Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Getting FIRST 10 rows with a descending query

128425Dec 7 2001
I need to get the "last 10" rows, basically, from a table.
If I do
SELECT *
FROM emp
WHERE ROWNUM < 10
ORDER BY emp_no DESC
Oracle gets the rownum first, then sorts the first 10 in
descending order.

Is there a way to get the last X rows?

Thanks,
Lorrie Gagnon
lorrie_gagnon@hp.com

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 4 2002
Added on Dec 7 2001
2 comments
385 views