|
想同时对卡片销量及标签业绩进行百分比汇总:
select *, Hz1.卡片销量/Hz2.卡片销量 as 分类百分比,Hz1.标签业绩/Hz2.标签业绩 as 标签百分比
from
(select 营业部,操作员,sum(卡片销售量) as 卡片销量,sum(标签销售量+标签安装量*1.5) as 标签业绩
from [Sheet2$] group by 营业部,操作员) as Hz1,
(select 营业部,sum(卡片销售量) as 卡片销量,sum(标签销售量+标签安装量*1.5) as 标签业绩
from [Sheet2$] group by 营业部) as Hz2
where hz1.营业部=Hz2.营业部
上面的代码,去掉“Hz1.标签业绩/Hz2.标签业绩 as 标签百分比”则正常,加入则不正常,或者把“Hz1.卡片销量/Hz2.卡片销量 as 分类百分比”去掉,只保留“
Hz1.标签业绩/Hz2.标签业绩 as 标签百分比”也不正常。
想不通是什么原因,请高手指教,或通过那种方式可同时对上述两个数据进行汇总百分比。
[ 本帖最后由 lysm 于 2011-1-27 09:05 编辑 ] |
|