IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

SPUFI -- Joining 3 tables – data in 2 tables, none in 3rd


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Sysaron

New User


Joined: 28 Sep 2005
Posts: 55
Location: USA

PostPosted: Wed Mar 08, 2017 4:18 am
Reply with quote

I am joining three tables with SPUFI. Tables A & B always have the data. Table 3 only has the matching data 85% of the time. I want to write out the data for tables A & B, even when Table C row is not found. Currently it only writes data when all three tables have data. Please Advise. Thank you in Advance.

Code:
****** ***************************** Top of Data 
000100 SELECT
000200       A.GROUP_NUMBER,
000201       A.DEFAULT_YEAR,
000210       B.FK_SALE_NO,
000500       C.USE_KEY_1
000800 FROM  DBTCTR8.TRTPSDTP A,
000900       DBTCTR8.TRTPSTPS B,
000910       DBTCTR8.TRTPUKEY C
001000 WHERE A.GROUP_NUMBER = 2039014031
001010 AND   A.DEFAULT_YEAR = 2002
001011 AND   A.GROUP_NUMBER = B.FK_SDTP_GROUP_NO
001020 AND   (B.FK_SDTP_GROUP_NO = C.FK_STPTS_AIN (or C.row not found))
001230 GROUP BY A.GROUP_NUMBER, A.DEFAULT_YEAR, C.USE_KEY_1,
001240      B.FK_SALE_NO;
****** **************************** Bottom of Data
Back to top
View user's profile Send private message
RahulG31

Active User


Joined: 20 Dec 2014
Posts: 446
Location: USA

PostPosted: Wed Mar 08, 2017 5:33 am
Reply with quote

Ever heard of Outer Join?

.
Back to top
View user's profile Send private message
Sysaron

New User


Joined: 28 Sep 2005
Posts: 55
Location: USA

PostPosted: Wed Mar 08, 2017 5:38 am
Reply with quote

This newbie will look it up. Thank you. icon_lol.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts DELETE SPUFI DB2 1
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
No new posts SCOPE PENDING option -check data DB2 2
No new posts Adding QMF and SPUFI to the ISPF menu DB2 20
No new posts Check data with Exception Table DB2 0
Search our Forums:

Back to Top