Tim Pilgrim
07/20/2022, 12:46 PMWITH DATA AS (
SELECT parentitm.itemid parentname, itemmember.parentitem parent, itemmember.item itemid,
item.itemtype itemtype, itemmember.itemsource itemsource,
item.itemid componentname,
itemmember.quantity quantity,
itemmember.memberunit memberunit,
itemmember.linenumber linenumber,
aggregateItemLocation.location location,
BUILTIN.DF(aggregateItemLocation.location) locationname,
aggregateItemLocation.quantityavailable qtyonhand
FROM itemmember
LEFT JOIN item ON itemmember.item = item.id
LEFT JOIN item parentitm ON itemmember.parentitem = parentitm.id
LEFT JOIN aggregateItemLocation ON aggregateItemLocation.item = itemmember.item
WHERE parentitm.isinactive = 'F' AND aggregateItemLocation.location = '131'
)
SELECT parent, parentname, itemid, componentname, itemtype, itemsource, quantity,
memberunit, location, locationname, qtyonhand, linenumber, LEVEL componentlevel,
LEVEL||'-'||linenumber componentlevelwithline
-- , SYS_CONNECT_BY_PATH(parentname, '-')
FROM DATA
START WITH parent IN('207264', '207265')
CONNECT BY PRIOR itemid = parent
ORDER SIBLINGS BY itemid
if you uncomment
-- , SYS_CONNECT_BY_PATH(parentname, '-')
this query will fail, with it commented it will work but I can not tell which components are for item 207264 or 207265
any ideas really appreciate.michoel
07/20/2022, 12:56 PMBUILTIN.HEIRARCHY
which I've never managed to get working eitherTim Pilgrim
07/20/2022, 1:09 PMLandor
07/20/2022, 5:32 PM