Hello,
If anybody will need this. I solved my task for asset hierarchy order with CTE query for DB2:
```
WITH lochie(locnum, locpnt, locste, locname,loclcn,locposition, loclvl) AS (
SELECT p.assetid, p.parentassetid, p.siteid, p.name, p.lcn, p.position,0 loclvl from plusasaonoff p
where p.assetid=(select assetid from asset where assetnum='917913630138' fetch first row only) and p.offtime is null
UNION ALL
SELECT assetid, parentassetid, siteid, name,lcn,position, (loclvl + 1) loclvl
FROM plusasaonoff p, lochie WHERE p.siteid = locste AND p.parentassetid = locnum and p.offtime is null
)
SELECT distinct a.loclcn as LCN, a.locposition as position, a.locname as position_name, p.assetnum, p.serialnum, ac.item as ASSET_PARENT_CM_ITEM, a.locnum, a.locpnt, a.loclvl as HIERARCHYLEVELS
FROM lochie a
LEFT JOIN asset p on p.siteid = a.locste and a.locnum = p.assetid and p.plusacatid is not null
left join plusacacat ac on ac.plusacacatid=p.plusacatid
order by LCN
```
------------------------------
Blaz Rakar
------------------------------
Original Message:
Sent: Mon June 21, 2021 02:15 PM
From: Bradley Downing
Subject: BIRT Hieararchy order
I do not understand the question here. Please clarify.
------------------------------
Bradley K. Downing , MBA
IBM Certified Adv. Deployment Prof. Maximo v7.6.1
IBM
Bakersfield CA
------------------------------