Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: Getting last rows
In 8i you can execute such statement :
select id_col from
(select select ID_COL,rownum row_num from MYTABLE where mycondition order by
ID_COL)
where row_num < 100
In both 8i and 7 you can use more complex one:
select id_col from
(select select ID_COL,rownum row_num from MYTABLE where mycondition
union select null id_col,null row_num from dual)
where id_col is not null and row_num < 100
Last statement uses trick with implicit sorting in union. Of course, performance will be not so good.
"Azhdin" <flateric_at_freesurf.fr> wrote in message
news:98iqod$7vr$1_at_wanadoo.fr...
> Hello,
>
> how can i get the last rows from a select which have a rownum restriction
:
>
> Select ID_COL from MYTABLE where mycondition and rownum<100 order by
ID_COL
> desc;
>
> With this request i don't have the last entries.
> I am working with Oracle 7.3.4 and Oracle 8.1.6
>
> Best regards
>
>
>
>
Received on Mon Mar 12 2001 - 13:34:42 CST
![]() |
![]() |