这个是我已写好的,用excel透视acess里面的数据,因为数据量很大,有325M且以后还要增加,所以我想直接按周来透视汇总数据,这样提高透视的速度。(不是透视完数据,然后按周计算。)- select 经销商名称,款号,综合类别,商品颜色,性别,商务大类,商务小类,日期,年份,实际发货数量,0 as 实际销售数量,0 as 实际零售数量,实际发货金额,0 as 实际销售金额,0 as 实际零售金额,预计发货成本额,0 as 预计销售成本额,0 as 零售成本额,预计发货毛利,0 as 预计销售毛利,0 as 预计零售毛利,供应商名称,采购单价,材质,0 as 订单数量,跟型,筒高 from [发货查询] union all
- select 经销商名称,款号,综合类别,商品颜色,性别,商务大类,商务小类,日期,年份,0 as 实际发货数量,实际销售数量,0 as 实际零售数量,0 as 实际发货金额,实际销售金额,0 as 实际零售金额,0 as 预计发货成本额,预计销售成本额,0 as 预计零售成本额,0 as 预计发货毛利,预计销售毛利,0 as 预计零售毛利,供应商名称,采购单价,材质,0 as 订单数量,跟型,筒高 from [销售查询] union all
- select 经销商名称,款号,综合类别,商品颜色,性别,商务大类,商务小类,日期,年份,0 as 实际发货数量,0 as 实际销售数量,实际零售数量,0 as 实际发货金额,0 as 实际销售金额,实际零售金额,0 as 预计发货成本额,0 as 预计销售成本额,预计零售成本额,0 as 预计发货毛利,0 as 预计销售毛利,预计零售毛利,供应商名称,采购单价,材质,0 as 订单数量,跟型,筒高 from [零售查询] UNION ALL
- select 经销商名称,款号,综合类别,商品颜色,性别,商务大类,商务小类,日期,年份,0 as 实际发货数量,0 as 实际销售数量,0 as 实际零售数量,0 as 实际发货金额,0 as 实际销售金额,0 as 实际零售金额,0 as 预计发货成本额,0 as 预计销售成本额,0 as 预计零售成本额,0 as 预计发货毛利,0 as 预计销售毛利,0 as 预计零售毛利,供应商名称,采购单价,材质,订单数量,跟型,筒高 from [订单查询];
复制代码 是否可以这样:- select 经销商名称,款号,综合类别,商品颜色,性别,商务大类,商务小类,year(日期) &"年第" & datediff('ww',year(日期)&'-1-1',日期)+1 & "周" as 按周,年份,实际发货数量,0 as 实际销售数量,0 as 实际零售数量,实际发货金额,0 as 实际销售金额,0 as 实际零售金额,预计发货成本额,0 as 预计销售成本额,0 as 零售成本额,预计发货毛利,0 as 预计销售毛利,0 as 预计零售毛利,供应商名称,采购单价,材质,0 as 订单数量,跟型,筒高 from [发货查询] union all
- select 经销商名称,款号,综合类别,商品颜色,性别,商务大类,商务小类,year(日期) &"年第" & datediff('ww',year(日期)&'-1-1',日期)+1 & "周" as 按周,年份,0 as 实际发货数量,实际销售数量,0 as 实际零售数量,0 as 实际发货金额,实际销售金额,0 as 实际零售金额,0 as 预计发货成本额,预计销售成本额,0 as 预计零售成本额,0 as 预计发货毛利,预计销售毛利,0 as 预计零售毛利,供应商名称,采购单价,材质,0 as 订单数量,跟型,筒高 from [销售查询] union all
- select 经销商名称,款号,综合类别,商品颜色,性别,商务大类,商务小类,year(日期) &"年第" & datediff('ww',year(日期)&'-1-1',日期)+1 & "周" as 按周,年份,0 as 实际发货数量,0 as 实际销售数量,实际零售数量,0 as 实际发货金额,0 as 实际销售金额,实际零售金额,0 as 预计发货成本额,0 as 预计销售成本额,预计零售成本额,0 as 预计发货毛利,0 as 预计销售毛利,预计零售毛利,供应商名称,采购单价,材质,0 as 订单数量,跟型,筒高 from [零售查询] UNION ALL
- select 经销商名称,款号,综合类别,商品颜色,性别,商务大类,商务小类,year(日期) &"年第" & datediff('ww',year(日期)&'-1-1',日期)+1 & "周" as 按周,年份,0 as 实际发货数量,0 as 实际销售数量,0 as 实际零售数量,0 as 实际发货金额,0 as 实际销售金额,0 as 实际零售金额,0 as 预计发货成本额,0 as 预计销售成本额,0 as 预计零售成本额,0 as 预计发货毛利,0 as 预计销售毛利,0 as 预计零售毛利,供应商名称,采购单价,材质,订单数量,跟型,筒高 from [订单查询];
复制代码 |