Home » SQL & PL/SQL » SQL & PL/SQL » how do i sum columns
how do i sum columns [message #235251] Fri, 04 May 2007 09:03
roba
Messages: 11
Registered: December 2006
Junior Member
I want to creat a column that will sum b.budorigoblg** and asks me for which ones so summ each time i run the sql.

for example sum b.budorigoblg11+budorigoblg12+budorigoblg01
or if posible be prompted to enter a range to sum such as OCT-MAY or b.budorigoblg11-05

i have each budorigoblg labeled with a month ie budorigoblg11 is OCT. the numberformat is $999,999,990.

i am using 10g and vi PLUS

this is my current select file

select b.budappn, b.budtitle, substr(b.budmamsco, 1, 3), b.budpm, b.budmdep,
b.budafp,
b.budallot, b.budfy,
b.budorigoblg10, b.budorigoblg11, b.budorigoblg12, b.budorigoblg01,
b.budorigoblg02, b.budorigoblg03, b.budorigoblg04, b.budorigoblg05,
b.budorigoblg06, b.budorigoblg07,
b.budorigoblg08, b.budorigoblg09, b.budstpmname, a.pm,
sum (case when substr(a.type_trans, 1, 1)='E' then amount end),
sum (case when substr(a.type_trans, 1, 1) in ('C','D') then amount end)
from stfhistory a,
budgetmaster b
Previous Topic: Temporary Tabelspace Issue (merged)
Next Topic: without colum name
Goto Forum:
  


Current Time: Sat Dec 10 01:10:40 CST 2016

Total time taken to generate the page: 0.09270 seconds