aggregation in SQL query
I would like to aggregate the result of a hierarchical query.
Here is the query :
decode(pdt_niv,5,pdt_cod,null) as niv5,
decode(pdt_niv,4,pdt_cod,null) as niv4,
decode(pdt_niv,3,pdt_cod,null) as niv3,
decode(pdt_niv,2,pdt_cod,null) as niv2,
decode(pdt_niv,1,pdt_cod,null) as niv1
connect by pdt_cod =prior pdt_per_cod
start with pdt_niv=5
Here is the result :
LEVEL NIV5 NIV4 NIV3 NIV2 NIV1
Here is the result I need :
NIV5 NIV4 NIV3 NIV2 NIV1
F203 RG11 TPAP TMAT TPHR
F206 RG11 TPAP TMAT TPHR
P005 F307 TPAP TMAT TPHR
Any idea ?
Any help would be appreciated ...
Thanks a lot in advance !
Click Here to Expand Forum to Full Width