我有3個表:1.Parent,2.Child1Table和3.Child2Table如何使記錄的聯接不存在於另一個表上?
家長
ParentItem soldQty
----------------------
111 5
222 10
333 4
Child1Table
ParentItem ChildItemID1 soldQty
-------------------------------------
555 551 5
222 221 10
333 331 14
Child2Table
ParentItem ChildItemID2 soldQty
-------------------------------------
555 552 5
666 662 10
333 332 20
期待輸出
ParentItem QtySold
---------------------
111 5 //5
222 20 //10 + 10
333 38 //4 + 14 + 20
555 10 //5 + 5
666 10 //10
是否有可能使用FULL OUTER JOIN
實現這一目標?
爲什麼你有兩個不同的子表? – jarlh
@jarlh其實我有3個子表。這是我的情況。 –
你寫了什麼查詢以獲得預期輸出? –