|Subject:||Oracle Query Math|
|Date:||Thu, 29 Nov 2007|
I have a query:
SELECT GROUP_NAME, PERCENT FROM GROUPSUMMARY
WHERE REPORT_DATE= TO_DATE( '2007-10-01','YYYY-MM-DD')
ORDER BY PERCENT DESC;
I get results like this:
What I want is a query that returns the top 5 rows and then a sixth
row with a calculation that is the sum of any result rows past row 5,
which could be variable.
So I want the results to show this:
Where "Other" is 100-(sum of rows 1-5).
Is this possible with a query? This is an Oracle 10G database, not
sure about the patch level. Thanks for your help!