Skip to content

Instantly share code, notes, and snippets.

@naranjja
Created February 4, 2020 22:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save naranjja/e17947f398c6fd7c48a271ee6b7417b5 to your computer and use it in GitHub Desktop.
Save naranjja/e17947f398c6fd7c48a271ee6b7417b5 to your computer and use it in GitHub Desktop.
Get last N_ROWS and sort ascending afterwards in Oracle 11.g
select *
from (
select *
from TABLE
order by SORT_COLUMN desc
) temp
where rownum <= N_ROWS
order by SORT_COLUMN asc;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment