SQL Server:SQL 代码分解 BOM 以获得最小的孩子

问题描述 投票:0回答:0

谁能提供BOM爆表SQL代码。 我有 MATNR(Parent), IDNRK(child material) 的表格。

enter image description here

输入

Parent_material Child_Material
454000158452    454000144311
454000158452    454000155772
454000158452    454000173361
454000158452    454000173581
454000158452    454000264591
454000173361    454000173301

输出

454000158452|454000144311   
454000158452|454000155772   
454000158452|454000173361   
454000158452|454000173581   
454000158452|454000264591   
454000173361|454000173301   
454000158452|454000173361|454000173301  

因为454000173361是Phantom

sql sap
© www.soinside.com 2019 - 2024. All rights reserved.