Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL Question, taking differences between sum of columns
There are two ways to start thinking about your problem. Either write
different functions to return the specific parts of your formula you
want or have a SQL statment that uses the GROUP BY clause.
Anil G wrote:
> Hi,
>
> I have following table structure, tbl1( type_code varchar2(100), val
> integer)
> having data as:
> Type Val
> --------- --------------
> G1 10
> G1 23
> G2 22
> G2 21
> G3 43
> G4 11
> G4 33
> G5 44
>
> I would like to perform calculation such as ((sum(G1) + sum(G2)) -
> sum(G3)
>
> And further more ((sum(G1) + sum(G2)) - sum(G3) * sum(G4)
>
>
> Any help would be appriciated,
>
> Thanks,
> Anil G
Received on Wed Jul 12 2006 - 01:35:59 CDT