0

I want to convert my parent child table to pivot,below is my query

CREATE  TABLE parent_child 
with recursive cte (id, name, parentid,level) as (
  select     id,
             name,
             parentid,
              0 level
  from       CONFIG_CLASSIFICATION
  where parentid is null
  union all
  select     p.id,
             p.name,
             p.parentid,
            cte.level + 1
  from       CONFIG_CLASSIFICATION p
  inner join cte
          on p.parentid = cte.id
)

My current output enter image description here

My desire output enter image description here

3

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.