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 -> Calculating Sum along the row and column

Calculating Sum along the row and column

From: <pankaj_wolfhunter_at_yahoo.co.in>
Date: 25 Jul 2006 23:46:58 -0700
Message-ID: <1153896418.159093.283440@m79g2000cwm.googlegroups.com>


Greetings,
I have a table with following format and values (a dummy one):

Name Catg col1 col2 col3

John   Catg1               100	 100       200
          Catg2	  200	  200      200
          Catg3	 300	  300      300

Marry  Catg1              400	  400      400
          Catg2	 500	  500      500
          Catg3  	 600	  600      600


I would like to come out with a report like format:

Name Catg col1 col2 col3 Total

John   Catg1              100	 100      200     400
          Catg2	 200	 200      200     600
          Catg3	 300	 300      300     900

Marry  Catg1              400	 400      400     1200
          Catg2	 500	 500      500     1500
          Catg3  	 600	 600      600     1800

Total  Catg1               500           500      600     1600
         Catg2               700           700      700     2100
         Catg3               900	 900      900     2700

Basically, total at the end of each row is the total of that row and total at the end of each column is the total of values in that column based on
the Catg
For eg:
The grand total for Catg1 in col1 is 500 and so on?

I was suggested with rollup and cube features but it also shows up the sub-total
that we dont want. All we want is the total along each row plus grant total at the end for each column based on Catg?

I am using :

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bi PL/SQL Release 10.2.0.1.0 - Production

Any help would be appreciated

TIA Received on Wed Jul 26 2006 - 01:46:58 CDT

Original text of this message

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