Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
SUM of row values using SQL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
Himanshu Khatri

New User


Joined: 11 Jun 2007
Posts: 15
Location: Pune

PostPosted: Thu Oct 11, 2007 4:25 pm    Post subject: SUM of row values using SQL
Reply with quote

Hi,

I have a table having columns: item number & 52 columns where each column represents 1 column.(1 year =52 weeks). Each 52 columns has number of sales of item.
I have to find through query cumulative sum of sales of particular item.
e.g. When user provides item number 7 & week number 10, SQL should return sum of(column1 + column2 +---+ column7) for item number 7.

TIA
Back to top
View user's profile Send private message

saptagiri kintali

New User


Joined: 21 Sep 2007
Posts: 20
Location: chennai

PostPosted: Thu Oct 11, 2007 6:30 pm    Post subject: Reply to: SUM of row values
Reply with quote

hi,
try this..
SELECT (COL1 + COL2....) AS NEWCOL FROM <TABE NAME> WHERE <COND..>
Back to top
View user's profile Send private message
TG Murphy

Active User


Joined: 23 Mar 2007
Posts: 149
Location: Ottawa Canada

PostPosted: Thu Oct 11, 2007 7:53 pm    Post subject:
Reply with quote

Whoever defined your table that way should really be responsible for answering your question.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts LOW VALUES as a KEY juares castro DB2 10 Sat Apr 07, 2018 1:06 am
No new posts Query to compare 2 values of 1 column... Poha Eater DB2 13 Fri Mar 09, 2018 10:45 am
No new posts attchmvs from rexx subroutine that re... harisukumaran CLIST & REXX 1 Fri Jan 19, 2018 5:29 am
No new posts Extend the decimal values in DIVISION Balaryan DFSORT/ICETOOL 3 Thu Oct 05, 2017 4:05 pm
No new posts Working with hex values in Filemanage... Emile Straker IBM Tools 1 Tue Sep 12, 2017 1:42 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us