Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Top N Percentage

Status
Not open for further replies.
Dec 13, 2004
63
0
0
US
I am using Crystal Reports X and an Oracle DB.

I have approximately 6000 employee records with salaries. I would like to extract 10% of the 6000 employees with the highest salaries.

The result should be 600 employees extracted with the highest salaries.

Please help!

 
You might be able to use a command like this:

Select top 600 table.`salary`, table.`employee`
from table
Order by table.`salary` desc

This isn't a percentage though. Not sure how to do that in a command, but you could instead allow all records into the report, sort by salary descending, and create a running total {#cntall} like this: count of {table.employee}, evaluate for each record, reset never. Then go to the section expert->details->suppress and enter:

{#cntall} > distinctcount({table.employee})/10

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top