Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: a simple SELECT ?
Try
select *
from (select *
from mysales where id=999
instead
Regards
Dante
In article <7i7egm$93p$1_at_nnrp1.deja.com>,
shiling_at_math.wayne.edu wrote:
> Be careful when one uses rownum as a criterion. And in this case the
> query result may be wrong if one wants 15-jan-99,14-jan-99,13-jan-99.
>
> SQL> select * from mysales
> 2 where id=999;
>
> ID ITEM UNITS PURCHASE_
> --------- -------- --------- ---------
> 999 12-JAN-99
> 999 15-JAN-99
> 999 13-JAN-99
> 999 14-JAN-99
>
> SQL> select * from mysales
> 2 where id=999 and rownum <=3
> 3 order by purchase_date desc
> 4 /
>
> ID ITEM UNITS PURCHASE_
> --------- -------- --------- ---------
> 999 15-JAN-99
> 999 13-JAN-99
> 999 12-JAN-99
>
> > More simple:
> >
> > select * from deliveries
> > where rownum<=10
> > order by date desc
> >
> >
>
> --== Sent via Deja.com http://www.deja.com/ ==--
> ---Share what you know. Learn what you don't.---
>
--== Sent via Deja.com http://www.deja.com/ ==-- ---Share what you know. Learn what you don't.--- Received on Tue May 25 1999 - 05:36:07 CDT
![]() |
![]() |