In one of my previous ROLLUP posts I showed you how to generate summary information. However, the output of ROLLUP includes the rows produced by the regular GROUP BY operation along with the summary rows.
So, what if you are only interested in totals. Well, Oracle does provide an extension to the GROUP BY clause called GROUPING SETS that you can use to generate summary information at the level you choose without including all the rows produced by the regular GROUP BY operation.
Lets take a look at an example:
| Title | Under | Posted on |
|---|---|---|
| Abs Mgmt: How can Abs rule pro-rate contractor's last month's entitlement (need help urgently) | PeopleSoft Functional | 03/10/2010 - 9:21pm |
| Can we user LONG datatype as a search option in PeopleSoft | PeopleSoft Technical | 03/10/2010 - 11:22am |
| special caracters are not translated correctly when ftp from windows to unix | Programming | 03/09/2010 - 3:23pm |
| How to view the employees from particular country in peoplesoft? | PeopleSoft Technical | 03/03/2010 - 1:56am |
Comments
And what if I'm interested in totals but I want only one row for different years?
for example:
YEAR JAN FEB MAR
------ ----------- ----------- ------------
2000 4496799 4988535 5578521
2001 5029212 5074332 4960311
>> but I want only one row for different years
You can get the total for each month in every year by grouping by year and month. But you will not have one and only one row for each year. To accomplish what you want, you need to look at how to convert rows into columns. Here is a tip on how to do that posted at Oracle's site
http://www.oracle.com/technology/oramag/code/tips2004/050304.html
Give back to the community and help it grow!
* Help with unanswered forum questions and issues
* Register or login to share your knowledge at your own blog
select the employee using group by function where department member is greater than 4
Plz help me on the matter
Post new comment