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: 371
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 Replace values in the input data Vikas Maharnawar DFSORT/ICETOOL 10 Thu May 11, 2017 2:18 pm
No new posts Group Data based on a key Arun Raj DFSORT/ICETOOL 7 Thu Apr 27, 2017 11:29 pm
No new posts unload data from table with lob columns farhad_evan DB2 0 Sat Apr 22, 2017 1:32 pm
No new posts SORT JSON type of data maxsubrat DFSORT/ICETOOL 8 Wed Apr 19, 2017 6:01 pm
No new posts Data replication from multiple Db2 ta... kishpra DB2 9 Mon Mar 27, 2017 9:58 pm


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