Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: SPUFI -- Joining 3 tables – data in 2 tables, none in 3rd
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: 378
Location: USA

PostPosted: Wed Mar 08, 2017 5:33 am    Post subject: Reply to: SPUFI -- Joining 3 tables – data in 2 tables, none in 3rd
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    Post subject:
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    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 copying data without knowing location arunsoods DFSORT/ICETOOL 2 Thu Jul 20, 2017 1:03 pm
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Loading data to table gives wrong for... Raghu navaikulam DB2 16 Thu Jul 13, 2017 2:11 pm
No new posts SQL - select data available in index Nileshkul DB2 3 Mon Jun 26, 2017 1:30 am
No new posts Identify top 30 big tables or indexes... ashek15 DB2 0 Fri Jun 16, 2017 10:01 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us