Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Calling all SQL Gurus ...

Calling all SQL Gurus ...

From: PMG <pete_g_at_2xtreme.net>
Date: Sat, 12 Dec 1998 06:48:13 GMT
Message-ID: <367211A5.18EBEA34@2xtreme.net>


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 Received on Sat Dec 12 1998 - 00:48:13 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US