|
|
发表于 2009/4/11 11:19:07
|
显示全部楼层
--言归正传
SELECT TOP 1 item01, qty01
FROM bom
WHERE (item01 = 'A')
union all
select 'B',(t1.qty02 * t2.qty02 * t3.qty02 + T4.qty02 * T5.qty02 + T6.qty02) as qty01 from
(select qty02 from bom where item01 = 'E' and item02 = 'B') as T1,
(select qty02 from bom where item01 = 'C' and item02 = 'E') as T2,
(select qty02 from bom where item01 = 'A' and item02 = 'C') as T3,
(select qty02 from bom where item01 = 'C' and item02 = 'B') as T4,
(select qty02 from bom where item01 = 'A' and item02 = 'C') as T5,
(select qty02 from bom where item01 = 'A' and item02 = 'B') as T6
union all
select 'D',(t1.qty02 * t2.qty02 * t3.qty02 + T4.qty02 * T5.qty02 + T6.qty02) as qty01 from
(select qty02 from bom where item01 = 'E' and item02 = 'D') as T1,
(select qty02 from bom where item01 = 'C' and item02 = 'E') as T2,
(select qty02 from bom where item01 = 'A' and item02 = 'C') as T3,
(select qty02 from bom where item01 = 'C' and item02 = 'D') as T4,
(select qty02 from bom where item01 = 'A' and item02 = 'C') as T5,
(select qty02 from bom where item01 = 'A' and item02 = 'D') as T6 |
|