日期:2014-05-17 浏览次数:20591 次
-->try ;with cte as ( select 父项,子项,阶层数,材料费,加工费 as 成本 from BOM where 阶层数=(select max(阶层数) from BOM) union all select a.父项,a.子项,a.阶层数,a.材料费,a.加工费+b.材料费 from BOM a,cte b where b.父项=a.子项 and a.阶层数=b.阶层数-1 ) select * from cte
------解决方案--------------------