Get last 3 rows
RanieriOct 6 2009 — edited Oct 6 2009Hello,
I'm trying to get the last 3 rows of a table ordened by task_id, but it always return the first lines ordened... I'm using the query below:
Task table:
task_id | Comment
1 | comment 1
2 | comment 2
3 | comment 3
4 | comment 4
5 | comment 5
6 | comment 6
select task_id, comment
from tasks
where rownum <= 3
order by task_id desc
the result is always returning the first three lines (1,2,3) and it's not what I want, I want the last 3 lines (4,5,6)...
I think my problem is about rownum use, but I don't know what to do :(
I appreciate any help.
Thanks