|
请见附件:
多个工作表合并成数据透视表.rar
(13.96 KB, 下载次数: 15)
- select
- a.*,
- 销售数量/分月门店销量 as 分月门店量比,
- 销售额/分月门店销售额 as 分月门店额比 ,
- 销售数量/门店销量 as 门店量比,
- 销售额/门店销售额 as 门店额比
- from
- (
- select
- *,
- "一月" as 月份
- from
- [一月$]
- union all
- select
- *,
- "二月" as 月份
- from
- [二月$]
- )a,
- (
- select
- 月份,
- 门店,
- sum(销售额) as 分月门店销售额,
- sum(销售数量) as 分月门店销量
- from
- (
- select
- *,
- "一月" as 月份
- from
- [一月$]
- union all
- select
- *,
- "二月" as 月份
- from
- [二月$]
- )
- group by
- 月份,
- 门店
- )b,
- (
- select
- 门店,
- sum(销售额) as 门店销售额,
- sum(销售数量) as 门店销量
- from
- (
- select
- *,
- "一月" as 月份
- from
- [一月$]
- union all
- select
- *,
- "二月" as 月份
- from
- [二月$]
- )
- group by
- 门店
- )c
- where
- a.门店=b.门店
- and
- a.月份=b.月份
- and
- a.门店=c.门店
复制代码 |
|