| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Calculating Sum along the row and column
Carlos wrote:
> pankaj_wolfhunter_at_yahoo.co.in wrote:
> > 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
>
> Once more time:
>
> As The Wise Man (TK) says: 'Analytics rock, analytics roll.'
>
> HTH
>
> Cheers.
>
> Carlos.
Thanks for the reply. Consider me a newbie in oracle.
Actually I did some R&D with analytic functions but not able to get
which one is suitable
and how to go for it. 
Can you please guide me in this?
Received on Wed Jul 26 2006 - 03:56:38 CDT
![]()  | 
![]()  |