|
两个附件均来自本版。见附件。
toushibiao中的SQL语句为(原帖http://club.excelhome.net/viewthread.php?tid=518957&pid=3419815&page=1&extra=page%3D1):- select
- a.*,
- b.單價,
- b.單價*a.數量 as 工资
- from
- (
- select
- *,
- 產品&工序 as ID
- from
- [數據$]
- )a
- left join
- (
- select
- *,
- 產品&工序 as ID
- from
- [單價$]
- )b
- on a.ID=b.ID
复制代码 毛利率问题中的SQL语句为(原帖http://club.excelhome.net/thread-517606-1-1.html)- select
- a.*,
- a.销售数量*b.进货均价 as 销售成本
- from
- (
- select
- *,
- 供货商&产品型号 as Out_ID
- from
- [销售$]
- )a
- left Join
- (
- select
- In_ID,
- sum(进货金额)/sum(进货数量) as 进货均价
- from
- (
- select *,
- 供货商&产品型号 as In_ID
- from
- [进货$]
- )
- group by In_ID
- )b
- on
- a.Out_ID=b.In_ID
复制代码
toushibiao.rar
(9.47 KB, 下载次数: 47)
毛利率问题.rar
(17.19 KB, 下载次数: 41)
正确的toushibiao附件:
toushibiao.rar
(11.37 KB, 下载次数: 76)
[ 本帖最后由 masterexcel 于 2009-12-28 21:55 编辑 ] |
|