表1:
品牌 數量 金額 成本金額 毛利
諾基亞 10 100 50 50
索尼 20 200 100 100
蘋果 30 300 150 150
表2:
品牌 數量 金額 成本金額 毛利
諾基亞 5 50 25 25
索尼 6 60 30 30
三星 7 70 35 35
小米 8 80 40 40
需要得到的結果:
表3:
品牌 數量 金額 成本金額 毛利
諾基亞 15 150 75 75
索尼 26 260 130 130
蘋果 30 300 150 150
三星 7 70 35 35
小米 8 80 40 40
求大神解答解決辦法
uj5u.com熱心網友回復:
select a.品牌,a.數量+b.數量 as 數量,a.金額+b.金額 as 金額,a.成本金額+b.成本金額 as 成本金額,a.毛利+b.毛利 as 毛利 from 表1 as a,表2 as b where a.品牌=b.品牌union select 品牌,數量,金額,成本金額,毛利 from 表1 where not exist (select 品牌 from 表2)
union select 品牌,數量,金額,成本金額,毛利 from 表2 where not exist (select 品牌 from 表1)
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/139645.html
標籤:VBA
上一篇:vb dll
