I've been googling for a while and can not find the solution to this.
I'm trying to Join a Sales Table with two separate discount tables. When I join the tables together the Sales is repeated on each line. I want to have the sales number show up only once and have the rest of the rows show zero. I also want the two discount columns to be in the same column.
If anyone can point me in the right direction I would eternally grateful.
Sale Data
[TABLE="width: 367"]
<colgroup><col><col><col></colgroup><tbody>[TR]
[TD]Transaction Number[/TD]
[TD]Transaction Line[/TD]
[TD]Gross Sales[/TD]
[/TR]
[TR]
[TD="align: right"]361449[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1563.12[/TD]
[/TR]
[TR]
[TD="align: right"]361449[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]1302.6[/TD]
[/TR]
[TR]
[TD="align: right"]361449[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]8676.36[/TD]
[/TR]
[TR]
[TD="align: right"]361449[/TD]
[TD="align: right"]4[/TD]
[TD="align: right"]7850.04[/TD]
[/TR]
</tbody>[/TABLE]
Discount Table 1
[TABLE="width: 509"]
<colgroup><col><col><col><col></colgroup><tbody>[TR]
[TD]Invoice Number[/TD]
[TD]Invoice Line Number[/TD]
[TD]Promotion Code[/TD]
[TD]Discount Value[/TD]
[/TR]
[TR]
[TD="align: right"]361449[/TD]
[TD="align: right"]1[/TD]
[TD]SCB1.00 [/TD]
[TD="align: right"]15.63[/TD]
[/TR]
[TR]
[TD="align: right"]361449[/TD]
[TD="align: right"]2[/TD]
[TD]SCB1.00 [/TD]
[TD="align: right"]13.03[/TD]
[/TR]
[TR]
[TD="align: right"]361449[/TD]
[TD="align: right"]3[/TD]
[TD]SCRM1.00 [/TD]
[TD="align: right"]86.76[/TD]
[/TR]
[TR]
[TD="align: right"]361449[/TD]
[TD="align: right"]1[/TD]
[TD]PDS[/TD]
[TD="align: right"]20[/TD]
[/TR]
[TR]
[TD="align: right"]361449[/TD]
[TD="align: right"]4[/TD]
[TD]SCRM1.00 [/TD]
[TD="align: right"]78.5[/TD]
[/TR]
</tbody>[/TABLE]
Discount Table 2
[TABLE="width: 549"]
<colgroup><col><col><col><col></colgroup><tbody>[TR]
[TD]Invoice Number[/TD]
[TD]Invoice Line Number[/TD]
[TD]Adjustment Code[/TD]
[TD]Total Misc Adj Value[/TD]
[/TR]
[TR]
[TD="align: right"]361449[/TD]
[TD="align: right"]1[/TD]
[TD].20COFFEE [/TD]
[TD="align: right"]-15.6[/TD]
[/TR]
[TR]
[TD="align: right"]361449[/TD]
[TD="align: right"]1[/TD]
[TD]CA-CRV10 [/TD]
[TD="align: right"]46.8[/TD]
[/TR]
[TR]
[TD="align: right"]361449[/TD]
[TD="align: right"]2[/TD]
[TD].20COFFEE [/TD]
[TD="align: right"]-13[/TD]
[/TR]
[TR]
[TD="align: right"]361449[/TD]
[TD="align: right"]2[/TD]
[TD]CA-CRV10 [/TD]
[TD="align: right"]39[/TD]
[/TR]
[TR]
[TD="align: right"]361449[/TD]
[TD="align: right"]3[/TD]
[TD].17CRMRS [/TD]
[TD="align: right"]-78.54[/TD]
[/TR]
[TR]
[TD="align: right"]361449[/TD]
[TD="align: right"]4[/TD]
[TD].17CRMRS [/TD]
[TD="align: right"]-71.06[/TD]
[/TR]
</tbody>[/TABLE]
End Result
[TABLE="width: 745"]
<colgroup><col><col><col><col><col></colgroup><tbody>[TR]
[TD]Transaction Number[/TD]
[TD]Transaction Line[/TD]
[TD]Gross Sales[/TD]
[TD]Promotion Code[/TD]
[TD]Line Level.Discount Value[/TD]
[/TR]
[TR]
[TD]361449[/TD]
[TD]1[/TD]
[TD]1563.12[/TD]
[TD]SCB1.00 [/TD]
[TD]15.63[/TD]
[/TR]
[TR]
[TD]361449[/TD]
[TD]1[/TD]
[TD]0[/TD]
[TD]PDS[/TD]
[TD]20[/TD]
[/TR]
[TR]
[TD]361449[/TD]
[TD]1[/TD]
[TD]0[/TD]
[TD].20COFFEE [/TD]
[TD]-15.6[/TD]
[/TR]
[TR]
[TD]361449[/TD]
[TD]1[/TD]
[TD]0[/TD]
[TD]CA-CRV10 [/TD]
[TD]46.8[/TD]
[/TR]
[TR]
[TD]361449[/TD]
[TD]2[/TD]
[TD]1302.6[/TD]
[TD]SCB1.00 [/TD]
[TD]13.03[/TD]
[/TR]
[TR]
[TD]361449[/TD]
[TD]2[/TD]
[TD]0[/TD]
[TD].20COFFEE [/TD]
[TD]-13[/TD]
[/TR]
[TR]
[TD]361449[/TD]
[TD]2[/TD]
[TD]0[/TD]
[TD]CA-CRV10 [/TD]
[TD]39[/TD]
[/TR]
[TR]
[TD]361449[/TD]
[TD]3[/TD]
[TD]8676.36[/TD]
[TD]SCRM1.00 [/TD]
[TD]86.76[/TD]
[/TR]
[TR]
[TD]361449[/TD]
[TD]3[/TD]
[TD]0[/TD]
[TD].17CRMRS [/TD]
[TD]-78.54[/TD]
[/TR]
[TR]
[TD]361449[/TD]
[TD]4[/TD]
[TD]7850.04[/TD]
[TD]SCRM1.00 [/TD]
[TD]78.5[/TD]
[/TR]
[TR]
[TD]361449[/TD]
[TD]4[/TD]
[TD]0[/TD]
[TD].17CRMRS [/TD]
[TD]-71.06[/TD]
[/TR]
</tbody>[/TABLE]
I'm trying to Join a Sales Table with two separate discount tables. When I join the tables together the Sales is repeated on each line. I want to have the sales number show up only once and have the rest of the rows show zero. I also want the two discount columns to be in the same column.
If anyone can point me in the right direction I would eternally grateful.
Sale Data
[TABLE="width: 367"]
<colgroup><col><col><col></colgroup><tbody>[TR]
[TD]Transaction Number[/TD]
[TD]Transaction Line[/TD]
[TD]Gross Sales[/TD]
[/TR]
[TR]
[TD="align: right"]361449[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1563.12[/TD]
[/TR]
[TR]
[TD="align: right"]361449[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]1302.6[/TD]
[/TR]
[TR]
[TD="align: right"]361449[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]8676.36[/TD]
[/TR]
[TR]
[TD="align: right"]361449[/TD]
[TD="align: right"]4[/TD]
[TD="align: right"]7850.04[/TD]
[/TR]
</tbody>[/TABLE]
Discount Table 1
[TABLE="width: 509"]
<colgroup><col><col><col><col></colgroup><tbody>[TR]
[TD]Invoice Number[/TD]
[TD]Invoice Line Number[/TD]
[TD]Promotion Code[/TD]
[TD]Discount Value[/TD]
[/TR]
[TR]
[TD="align: right"]361449[/TD]
[TD="align: right"]1[/TD]
[TD]SCB1.00 [/TD]
[TD="align: right"]15.63[/TD]
[/TR]
[TR]
[TD="align: right"]361449[/TD]
[TD="align: right"]2[/TD]
[TD]SCB1.00 [/TD]
[TD="align: right"]13.03[/TD]
[/TR]
[TR]
[TD="align: right"]361449[/TD]
[TD="align: right"]3[/TD]
[TD]SCRM1.00 [/TD]
[TD="align: right"]86.76[/TD]
[/TR]
[TR]
[TD="align: right"]361449[/TD]
[TD="align: right"]1[/TD]
[TD]PDS[/TD]
[TD="align: right"]20[/TD]
[/TR]
[TR]
[TD="align: right"]361449[/TD]
[TD="align: right"]4[/TD]
[TD]SCRM1.00 [/TD]
[TD="align: right"]78.5[/TD]
[/TR]
</tbody>[/TABLE]
Discount Table 2
[TABLE="width: 549"]
<colgroup><col><col><col><col></colgroup><tbody>[TR]
[TD]Invoice Number[/TD]
[TD]Invoice Line Number[/TD]
[TD]Adjustment Code[/TD]
[TD]Total Misc Adj Value[/TD]
[/TR]
[TR]
[TD="align: right"]361449[/TD]
[TD="align: right"]1[/TD]
[TD].20COFFEE [/TD]
[TD="align: right"]-15.6[/TD]
[/TR]
[TR]
[TD="align: right"]361449[/TD]
[TD="align: right"]1[/TD]
[TD]CA-CRV10 [/TD]
[TD="align: right"]46.8[/TD]
[/TR]
[TR]
[TD="align: right"]361449[/TD]
[TD="align: right"]2[/TD]
[TD].20COFFEE [/TD]
[TD="align: right"]-13[/TD]
[/TR]
[TR]
[TD="align: right"]361449[/TD]
[TD="align: right"]2[/TD]
[TD]CA-CRV10 [/TD]
[TD="align: right"]39[/TD]
[/TR]
[TR]
[TD="align: right"]361449[/TD]
[TD="align: right"]3[/TD]
[TD].17CRMRS [/TD]
[TD="align: right"]-78.54[/TD]
[/TR]
[TR]
[TD="align: right"]361449[/TD]
[TD="align: right"]4[/TD]
[TD].17CRMRS [/TD]
[TD="align: right"]-71.06[/TD]
[/TR]
</tbody>[/TABLE]
End Result
[TABLE="width: 745"]
<colgroup><col><col><col><col><col></colgroup><tbody>[TR]
[TD]Transaction Number[/TD]
[TD]Transaction Line[/TD]
[TD]Gross Sales[/TD]
[TD]Promotion Code[/TD]
[TD]Line Level.Discount Value[/TD]
[/TR]
[TR]
[TD]361449[/TD]
[TD]1[/TD]
[TD]1563.12[/TD]
[TD]SCB1.00 [/TD]
[TD]15.63[/TD]
[/TR]
[TR]
[TD]361449[/TD]
[TD]1[/TD]
[TD]0[/TD]
[TD]PDS[/TD]
[TD]20[/TD]
[/TR]
[TR]
[TD]361449[/TD]
[TD]1[/TD]
[TD]0[/TD]
[TD].20COFFEE [/TD]
[TD]-15.6[/TD]
[/TR]
[TR]
[TD]361449[/TD]
[TD]1[/TD]
[TD]0[/TD]
[TD]CA-CRV10 [/TD]
[TD]46.8[/TD]
[/TR]
[TR]
[TD]361449[/TD]
[TD]2[/TD]
[TD]1302.6[/TD]
[TD]SCB1.00 [/TD]
[TD]13.03[/TD]
[/TR]
[TR]
[TD]361449[/TD]
[TD]2[/TD]
[TD]0[/TD]
[TD].20COFFEE [/TD]
[TD]-13[/TD]
[/TR]
[TR]
[TD]361449[/TD]
[TD]2[/TD]
[TD]0[/TD]
[TD]CA-CRV10 [/TD]
[TD]39[/TD]
[/TR]
[TR]
[TD]361449[/TD]
[TD]3[/TD]
[TD]8676.36[/TD]
[TD]SCRM1.00 [/TD]
[TD]86.76[/TD]
[/TR]
[TR]
[TD]361449[/TD]
[TD]3[/TD]
[TD]0[/TD]
[TD].17CRMRS [/TD]
[TD]-78.54[/TD]
[/TR]
[TR]
[TD]361449[/TD]
[TD]4[/TD]
[TD]7850.04[/TD]
[TD]SCRM1.00 [/TD]
[TD]78.5[/TD]
[/TR]
[TR]
[TD]361449[/TD]
[TD]4[/TD]
[TD]0[/TD]
[TD].17CRMRS [/TD]
[TD]-71.06[/TD]
[/TR]
</tbody>[/TABLE]