Xref: alice comp.databases.oracle.misc:23711
Path: alice!news-feed.fnsi.net!news.maxwell.syr.edu!newsfeed.cwix.com!207.0.56.122!news.eli.net!not-for-mail
Message-ID: <367211A5.18EBEA34@2xtreme.net>
From: PMG <pete_g@2xtreme.net>
X-Mailer: Mozilla 4.5 [en] (Win95; I)
X-Accept-Language: en
MIME-Version: 1.0
Newsgroups: comp.databases.oracle.misc
Subject: Calling all SQL Gurus ...
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 19
Date: Sat, 12 Dec 1998 06:48:13 GMT
X-Complaints-To: abuse@2xtreme.net
X-Trace: news.eli.net 913445293 209.63.215.67 (Fri, 11 Dec 1998 23:48:13 MDT)
NNTP-Posting-Date: Fri, 11 Dec 1998 23:48:13 MDT
Organization: 2xtreme.net NewsReader Service

I am having a little trouble coming up with a nice little SQL statement
that does the following:

group on a column,
come up with a count of each occurence of the group,
sort descending on the count,
calculate the running percentage of the total count for each group,
and return the top N groups.

ex: suppose I have a table of EMPLOYEES, and I would like to select the
first names which comprise the top 80% of all first names in the table.

Is this possible to do this as a single query?

TIA

Pete


