Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: How to do a limited select without using a where clause?
Do something like this:
SELECT * FROM
(SELECT * FROM YOUR_TABLE
WHERE MYCOL = MYCRITERIA ORDER BY MYORDER)
The inner select returns your data set, the outer select limits the number of rows.
<cjaouich_at_my-deja.com> wrote in message news:8mmuo2$e5c$1_at_nnrp1.deja.com...
> Hi, if I am not posting to the right forum, please point me in the
> right direction.
>
> I am trying to do a SQL select that is using an order by clause. The
> statement return 100+ rows, but I only want the first 5 rows of the
> order by clause without specifying a limit or a where clause. Is this
> possible?
>
> ie:
>
> select date, mac, fqdn, dhcp_ip from clients where mac like = '0000%'
> order by date;
>
> this return me a list of 100+ rows, but I want only the last 5, and I
> cannot use the date as a limit.
>
> Thanks in advance
>
> Cyril Jaouich
> ------------------------------------
> Opérations téléphonie IP - Vidéotron
> Vidéotron - IP Telephony Operations
> ------------------------------------
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
Received on Mon Aug 07 2000 - 00:00:00 CDT