Home > Software engineering >  Refer to excel merge two pivot table data
Refer to excel merge two pivot table data

Time:10-25

Table 1:
Brand margin amount cost amount
Nokia 100 50 fifty
SONY's 20, 200, 100, 100
Apple 30, 300, 150, 150

Table 2:
Brand margin amount cost amount
Nokia 5 50 25 25
SONY 60 30 June 30
Samsung 7 70 35 35
Millet 8 80 40 40

need to get the results:
Table 3:
Brand margin amount cost amount
Nokia's 15, 150, 75, 75
SONY 26, 260, 130, 130
Apple 30, 300, 150, 150
Samsung 7 70 35 35
Millet 8 80 40 40


O great god solve solution

CodePudding user response:

Brand, select a. a. number + b. quantity as quantity, a. amount + amount as amount, a. b. cost amount + b. a cost as a cost, a. Maori + b. margin as gross margin from table 1 as a, as in table 2 b where a. brand=b.
Union select brand, quantity, amount, cost, gross profit from table 1 where not exist (select brand from table 2.)
Union select brand, quantity, amount, cost, gross profit from table 2 where not exist (select the brand from table 1)
  •  Tags:  
  • VBA
  • Related