日期:2014-05-17 浏览次数:20623 次
select a.产品编码,a.成套编码,a.中文描述,a.材料,a.颜色,a.单价,b.材积, sum(a.单价)*b.材积 / sum(b.材积) as 拆分单价 from ( select cpbm.产品编码,cpbm.成套编码,cpbm.中文描述,cpbm.材料,cpbm.颜色,max(scd.单价) as 单价 from cpbm,scd where cpbm.产品编码 <> cpbm.成套编码 and scd.产品编码 = cpbm.产品编码 group by cpbm.产品编码,cpbm.成套编码,cpbm.中文描述,cpbm.材料,cpbm.颜色 )a, ( select bmzh.产品编码,sum(材积) as 材积 from jcld,bmzh where jcld.编码 = bmzh.编码 and 代码= 'A' group by bmzh.产品编码 )b where a.产品编码 = b.产品编码 group by a.产品编码,a.成套编码,a.中文描述,a.材料,a.颜色,a.单价,b.材积 order by a.产品编码 产品编码 成套编码 中文描述 材料 颜色 单价 材积 拆分单价 -------------------------------------------------- -------------------------------------------------- --------------------------------------------------------------------------------------------------------------- ------------------------------ ---------------------------------------- --------------------------------------- --------------------------------------- --------------------------------------- 00/2820SM-2-1 00/2820SM 拉台,台面,1750(拉开2250)*820*763,分二包打包 橡木 ERCOL-001C# 160.00 0.034805 160.000000 00/2821SM-TOP 00/2821SM 二门落台仅面板,1148*459*29,8只一包 橡木 ERCOL-001C# 19.00 0.003916 19.000000 00/2824SM-TOP 00/2824SM 咖啡桌仅面板,848*848*25,8只一包 橡木 ERCOL-001C# 23.00 0.002996 23.000000 00/2825SM-TOP 00/2825SM 单人茶几仅面板,498*348*25,8只一包 橡木 ERCOL-001C# 8.00 0.001317 8.000000 00/2826SM-TOP 00/2826SM 沙发桌仅面板,1148*398*25,4只一包