Multi Level Pegging BAQ or SQL Help

Hi Everyone,

I have tried multiple BAQ’s to try and get the Multi Level Pegging tables (PegDmdMst, PegLink, and PegSupMst) to iterate through multiple BOM levels. Does anyone have a BAQ or SQL code they would be willing to share with me? I can get it to iterate once, and my only idea is to create many CTE queries, but I’m not even sure how I would do that. Any help would be greatly appreciated!

MCS_Test_AK_AZB (2).baq (12.1 KB)
This is what I have so far for reference

I would use something like the bom_explode baq from here and then link those results to the pegging data. With some pegging joins you need to convert the numeric field to a varchar.

Probably SQL due to the amount of data we have, but I am not well versed in it so my idea was to try and get a BAQ written on a restricted amount of data and then transfer over! Also, thank you I will have to check that out!