SQLTeam.com | Weblogs | Forums

Exlpanation of sum joins



LEFT JOIN (SELECT TransI_lgnNumber, TransI_intPackageGroupNo,
                              SUM(TransI_curValueEach) AS TransI_curValueEach,
                              SUM(TransI_curNetTotal) AS TransI_curNetTotal,
                              SUM(TransI_curSTaxEach) AS TransI_curSTaxEach
                       FROM tblTrans_Inventory 
                       GROUP BY TransI_lgnNumber, TransI_intPackageGroupNo) I 
				ON I.TransI_lgnNumber = T.TransT_lgnNumber
				AND I.TransI_intPackageGroupNo = T.TransT_intPackageGroupNo

Can you explain me the query in the portion of sum. I mean how will the sum's change anything as in the end we are joining with I.lgnnumber. How will change the result?


It will not. You can remove the SUM expressions without any impact on the final result.


OK Great.