MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

UNION SUM

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
Sarangadhar
Beginner


Joined: 14 Oct 2004
Posts: 130
Topics: 43
Location: virtual village

PostPosted: Mon Apr 09, 2007 3:03 pm    Post subject: UNION SUM Reply with quote

Hi,
I have data in 3 tables. I need to sum up a column from three tables. If the matching row presents, sum the column in all tables, or sum in the tables wherever it is present.

SELECT AMOUNT1
FROM TABLE1

SELECT AMOUNT2
FROM TABLE2

SELECT AMOUNT3
FROM TABLE3

from the above 3 queries, if amounts are present in all tables for a particular criteria, i need them to add. if present in only one, i just need to pick and sum wherever the are present and create a single row in resultant table.
_________________
Thanks
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Mon Apr 09, 2007 3:47 pm    Post subject: Reply with quote

Sarangadhar,

show us a sample data and desired output along with the conditions to be checked.

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group