Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Consolidation of specific rows retaining another ones unaltered
"Sameer" <dolpheen_at_gmail.com> a écrit dans le message de news: 1161583581.942641.306680_at_k70g2000cwa.googlegroups.com...
| Dear All,
| Please have a look at this Google document.
| http://docs.google.com/View?docid=ddqx8p3w_1c2szdk
| I want to consolidate 3 rows (SAS-AP, SAS-AR, SAS-GL) into 1 row SAS by
| summing them columnwise and retaining sum into SAS row.
|
| One probable way is to group by using substr function on first three
| characters.
|
| SELECT togroup, sum(master), sum(TRANSACTIONs), sum(reports),
| sum(miscallaneous)FROM (SELECT mr_issues_typewise.*,
| SUBSTR(MODULE, 1, 3) AS togroup FROM mr_issues_typewise)GROUP
| BY togroup
|
| But this will also group INT- rows which I do not expect. Also I want
| to have module names in the output.
|
| How to do this? Please help.
|
| -Sameer
|
select decode(substr(module,1,3),'SAS','SAS',module) groupe,
sum(...)
from ...
group by <same decode>
/
Regards
Michel Cadot
Received on Mon Oct 23 2006 - 10:30:26 CDT