Re: Limiting # of hits via SQL
From: Pete Shaw <P.M.Shaw_at_sheffield.ac.uk>
Date: 1995/06/15
Message-ID: <3rp579$p0t_at_hippo.shef.ac.uk>#1/1
Date: 1995/06/15
Message-ID: <3rp579$p0t_at_hippo.shef.ac.uk>#1/1
In article <JOHNS.95Jun13115024_at_adwyer.gsfc.nasa.gov>, johns_at_adwyer.gsfc.nasa.gov (Steve Johns) says:
>Can someone mention to me how to tell SQLplus to only return the first
>'n' hits?
>We want to collect some stats automatically, and so we want a
>descending sort of access count on some DB items we serve, and we just
>want the top ten.
Try using the pseudo-column rownum.
Add the following to your 'where clause'...
<< Your query here >>
and rownum < 11
In most cases this should work.
Cheers Pete. Received on Thu Jun 15 1995 - 00:00:00 CEST