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 -> Re: SQL Question, taking differences between sum of columns

Re: SQL Question, taking differences between sum of columns

From: Omerion <erion.omeri_at_gmail.com>
Date: 11 Jul 2006 23:35:59 -0700
Message-ID: <1152686158.920208.295980@h48g2000cwc.googlegroups.com>


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

Original text of this message

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