Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Can this be done in SQL ?
I think you mean the first three items
If that's the case, then this should do:
Select x.Item_ID from sometable x
where x.date < '09-SEP-99';
If you only want 2 and three try:
Select x.Item_ID from sometable x
where x.date < '09-SEP-99'
and x.date > '01-SEP-99';
Peter
In article <929384284.13894.0.nnrp-08.d4e48d0d_at_news.demon.co.uk>,
"Matt Randle" <matt_at_imat.demon.co.uk> wrote:
> If the results of a query return a list of items sorted by date, is
there
> anyway of selecting the last 'n' items from the list before a given
date.
> For example, if the results of the query are,
>
> Item ID Date
> ===== ====
>
> 1 1/1/99
> 2 1/4/99
> 3 1/8/99
> 4 1/10/99
> 5 1/12/99
>
> An example query might be to return the ID's of the 2 items with a
date
> prior to 1/9/99 which should return ID's 2 and 3.
>
> Can this be done in one SQL statement ??
>
> Thanks,
>
> Matt.
>
>
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
Received on Mon Jun 14 1999 - 15:15:42 CDT