Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Re: SQL question: getting the 10 most recent records
Which version of Oracle are you using...The ordered subquery is not supported in pre 8.1.6 , I believe..
"Juan Carlos Muro" <SADACIA_at_santandersupernet.com> wrote:
>Hello. That almos worked.
>This works:
> select * from (select * from all_users) where rownum < 11;
>
>but this one doesn't:
> select * from (select * from all_users order by created desc) where
>rownum < 11;
>
>This is the error returned by Oracle:
> select * from (select * from all_users order by created desc) where
>rownum < 11
> *
> ERROR en línea 1:
> ORA-00907: falta el paréntesis derecho (=missing right parenthesis 'in
>Spanish')
>
>I have tryed these too:
>
> select * from all_users where exists (select * from all_users order by
>created desc) and rownum < 11;
> select * from all_users order by created desc where rownum < 11;
>
>but with no success.
>
>Any idea?
>Thanks a lot:
>
>Juan Carlos Muro
>
>
>"Steve Bell" <swayne.bell_at_sympatico.ca> escribió en el mensaje
>news:3AB78B26.D9B7CAE6_at_sympatico.ca...
>> Hi,
>>
>> How about something like:
>>
>> select event_id, event_d
>> from (select event_id,event_d from events order by event_d desc)
>> where rownum < 11
>>
>> Juan Carlos Muro wrote:
>>
>> > Hello. This is an SQL question.
>> >
>> > I have a table like this:
>> > create table events ( event_id number, event_d date );
>> >
>> > I want to get the 10 most recent events (by 'event_date' criteria) with
a
>> > select. Is that possible? Something like:
>> > select <the 10 most recent> from events order by date desc;
>> >
>> > Can U help me?
>> >
>> > Thank you:
>> > J. Carlos Muro
>>
>
Received on Thu Mar 22 2001 - 14:23:12 CST