首页 > 代码库 > with as 查询树递归的用法
with as 查询树递归的用法
with bomtmp as
(
select aMD001, aMD003, aMD006, aMD007, aMD008, 1 kind, aMB025 from BOMaMD join INVaMBTEM on aMB001 = aMD003 where aMD001 = ‘101101180169‘
union all
select a.aMD001, a.aMD003, a.aMD006, a.aMD007, a.aMD008, b.kind +1 kind , c.aMB025
from BOMaMD a
join bomtmp b on b.aMD003 = a.aMD001
join INVaMB c on c.aMB001 = a.aMD003
where b.aMB025 not in (‘M‘, ‘S‘,‘P‘)
)
select aMD001, aMD003, aMD006, aMD007, aMD008, kind, aMB025 from bomtmp order by kind ,aMD001;
-- 验证 数据
-- select aMB001, aMB025 from INVaMB where aMB001 =‘331101180109‘
--select * from dbo.MRP_BOaMD(‘101101180169‘,1,1,‘101101180169‘,‘WO‘)
with as 查询树递归的用法
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。