Re: Top ten again?

From: David Scott <dscott_at_cars.com>
Date: Tue, 20 Apr 93 14:37:52 EST
Message-ID: <01050023.vjeq03_at_fox.cars.com>


In article <sd345.735292697_at_Hampton> (comp.databases.oracle), sd345_at_city.ac.uk (Michael Collier) writes:
> Thanks to all the people who responded to my earlier post by
> by telling me to do a when rownum <= 10.
> However this doesn't seem to work...

This one is not as tough as you're making it. Create a view that includes the count (or other statistic), then query it using an ORDER BY column DESC clause with your ROWNUM <= 10

example:

CREATE VIEW TOPTEN AS
SELECT THECOLUMN column, COUNT(*) columnCount FROM THETABLE

SELECT column columncount FROM TOPTEN
ORDER BY columncount DESC
WHERE ROWNUM <= 10

Hope this works for you.


    David Scott ...how can I keep from singing?

      SnailMail: 463 Windol Court, Marietta, GA 30066
          Phone: 404-514-0122
     Compuserve: 71740,3321
       Internet: dscott_at_cars.com
Received on Tue Apr 20 1993 - 21:37:52 CEST

Original text of this message