Author: Sysaron
Subject: SPUFI -- Joining 3 tables â data in 2 tables, none in 3rd
Posted: Wed Mar 08, 2017 4:18 am (GMT 5.5)
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.
Subject: SPUFI -- Joining 3 tables â data in 2 tables, none in 3rd
Posted: Wed Mar 08, 2017 4:18 am (GMT 5.5)
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 |