|
我有两张表。一张是汇总数据规则。 另一张是数据表。如下图
规则表
Banner | Regoin | Store_Type | team_channel | Abest | Hunan | HM | | Abest | PRD | | | E-Mart | East | | Top Retailer Channel | LH Super | | | Top Retailer Channel | Lotte-East | East | HM | Top Retailer Channel |
数据表
Banner Name | Category | Sales | Regoin | Store_Type | team_channel | ABest | XXXXXX | 316,215 | Hunan | HM | Top 200 | ABest | XXXXXX | 40,151 | Hunan | SM | Top 200 | ABest | YYYYYY | 23,877 | Hunan | SM | Top 10 | ABest | XXXXXX | 88,100 | PRD | SM | Top 10 | ABest | XXXXXX | 1,306,860 | PRD | HM | Top 10 | ABest | YYYYYY | 96,476 | Shenzhen | SM | Top 10 | ABest | YYYYYY | 106,651 | 外区 | HM | Top 10 | E-mart | XXXXXX | 1,306,860 | East | HM | Top Retailer Channel | E-mart | YYYYYY | 96,476 | East | SM | Top Retailer Channel | E-mart | YYYYYY | 106,651 | East | HM | Top 10 | E-mart | ZZZZZZ | 162,282 | North | HM | Top 10 | Lotte-East | XXXXXX | 1,306,860 | East | HM | Top Retailer Channel | Lotte-East | YYYYYY | 96,476 | East | SM | Top Retailer Channel | Lotte-East | YYYYYY | 106,651 | East | HM | Top 10 | Lotte-East | ZZZZZZ | 162,282 | North | HM | Top 10 | LH super | YYYYYY | 96,476 | East | SM | Top Retailer Channel | LH super | YYYYYY | 106,651 | East | HM | Top 10 |
现在我想把数据表里。符合规则的数据汇总起来。例:对于abest 它的regoin为Hunan. store_type为HM。不管是什么team_channel,sales全都加起来。对于abest 它的regoin为PRD,不管是什么store_type,team_channel,sales全都加起来。以此类推。按规则汇总成下面的格式 。 在access里。SQL要怎么写法
| Sales | Abest | ??? | E-Mart | ??? | LH Super | ??? | Lotte-East | ??? |
access.rar
(12.27 KB, 下载次数: 4)
|
|