Re: SQL*plus -- limiting maximum number of returned rows?
Date: 1 Sep 92 13:05:17 GMT
Message-ID: <3894_at_keele.keele.ac.uk>
From article <1992Aug31.223520.28312_at_massey.ac.nz>, by M.W.Stern_at_massey.ac.nz (M.W. Stern):
> > I am working on a report that is supposed to find the "top 5" items in
> I believe the answer to this goes something like this,
But I think the poster wanted the first N rows of a result relation, not
a base table? This is one instance where the generalised SQL construct
would be valuable, assuming that intermediate relations had ROWNUMs.
> > a catagory. The query returns 0 or more rows based on the selection
> > criteria, sorted in the appropriate order. Some queries return a dozen
> > or more rows, but I'm only interested in the first 5.
>
> SELECT value FROM table WHERE ROWNUM <= 5
SELECT value FROM ( SELECT etc FROM etc WHERE etc )
WHERE ROWNUM <= 5
__ __ Paul Singleton (Mr) JANET: paul_at_uk.ac.keele.cs |__) (__ Computer Science Dept. other: paul_at_cs.keele.ac.uk | . __). Keele University, Newcastle, tel: +44 (0)782 621111 x7355 Staffs ST5 5BG, ENGLAND fax: +44 (0)782 713082Received on Tue Sep 01 1992 - 15:05:17 CEST