Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Selecting last n rows
This code won't work i'm afraid ;-(
The rownum method only works in simple queries.
Try
select * from the_table t1
where 10000 > (select count(primary_key) from the_table t2
where t1.primary_key < t2.primary_key);
Just replace primary key with the primary key from your table.
M
Vincent Lemaire wrote in message <7lcm92$rhj$1_at_minus.oleane.net>...
>I think you should try with the rownum pseudocolumn
>something like :
>
>select * from the_table
>where rownum >= (select max(rownum)-10 from the_table);
>
>if it is what you expected...?
>
>
Received on Wed Jun 30 1999 - 04:14:10 CDT
![]() |
![]() |