|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
select a.*,b.销售单价,a.数量*b.销售单价 as 合计 from
( select 产品名称,规格,"北京" as 产地,北京 as 数量 from [销售表$] union all
select 产品名称,规格,"大连" ,大连 from [销售表$] union all
select 产品名称,规格,"广州" ,广州 from [销售表$] union all
select 产品名称,规格,"海口" ,海口 from [销售表$] union all
select 产品名称,规格,"南京" ,南京 from [销售表$] union all
select 产品名称,规格,"上海" ,上海 from [销售表$] union all
select 产品名称,规格,"重庆" ,重庆 from [销售表$]
) a,[价格表$] b
where a.产品名称=b.产品名称 and a.规格=b.规格 and 数量 is not null
使用上述SQL语句,然后透视,应该可以满足楼主需要了 |
|