Quantcast
Channel: IBM Mainframe Computers Forums
Viewing all articles
Browse latest Browse all 8500

DB2 :: RE: Join of more than one table

$
0
0
Author: Rohit Umarjikar
Posted: Wed Feb 15, 2017 11:24 pm (GMT 5.5)

It looks like , I am too much loaded with the work, so please ignore my earlier comment of having "Same Results".
But yes you could have straight LEFT JOIN on tableD and get the second SUM form there and no need to have outer SELECT or anything. Compare the results with your other solution.
Code:
Select a.Col1,Sum1,b.Sum2
 From TableA a
 Inner join TableB
 on TableA.Colx = TableB.ColY
 Inner join TableC
 on TableB.Colx = TableC.ColY
 left outer join TableD b
 on TableC.Colx = TableD.ColY
group by a.Col1

_________________
Regards,
Rohit Umarjikar
"Knowledge is knowing that a tomato is a fruit, but Wisdom is knowing not to put it in a fruit salad."icon_razz.gif


Viewing all articles
Browse latest Browse all 8500

Trending Articles