Re: TOP TEN LISTS? HELP.

From: subba reddy annapureddy <sureddy_at_ix.netcom.com>
Date: 14 Dec 1994 21:25:39 GMT
Message-ID: <3cnnsj$6u3_at_ixnews1.ix.netcom.com>


In <3cmj5cINN7sd_at_news.ougf.fi> rissahe1_at_news.ougf.fi (Heikki Rissanen) writes:

>
>mwmaher_at_ACM.ORG wrote:
>: How do you create a listing of the top N items in a table
>: with straight SQL? This seems like such a basic task -
>: until you try it.
>
>This is not very effective and cannot be recommended with large
>tables and bad indexes, but something like this may work:
>
>SELECT FLD
>FROM TAB1 A
>WHERE 10 >= ( SELECT COUNT(*) FROM TAB1
> WHERE TAB1>A.FLD)
>ORDER BY FLD DESC
>
>Regards,
> Hessu
>
>--
>---------------------------------------------------------------------
>Heikki Rissanen, United Papermills, Rauma, Finland
>Email: heikki.rissanen_at_ra.upm.yhtyneet.mailnet.fi
>---------------------------------------------------------------------
>
Following is supposed to work. Try this

SELECT FLD
FROM TAB1 A
WHERE rownum <= 10; (here N = 10)



subba reddy , Sunnyvale CA - 94086 USA
Email : sureddy_at_ix.netcom.com
Received on Wed Dec 14 1994 - 22:25:39 CET

Original text of this message