Concatenate row values and display using With Claues

  • A Table name Relation contains the following data

    PARENT|CHILD| NUMBER

    NULL|a|NUM1

    a|b|NULL

    b|c|NULL

    c|d|NULL

    By using this query i am getting the following output

    the query is as follows

    with PRL (parent,child,number)as

    (

    select a.parent, a.child as parent ,a.number

    from relation a where a.parent is null

    union all

    select sl.parent,sl.child,p.number

    from relation sl inner join

    prl p on p.child=sl.parent

    )

    select * from prl

    PARENT | CHILD| NUMBER

    NULL |a|NUM1

    a|b|NUM1

    b|c|NUM1

    c|d|NUM1

    But i want the output like this the data in the child column should be concatenated and given as follows.

    CHILD| path|NUMBER

    a|d/c/b/a|NUM1

    This is very urgent requiremnt can any one help me out from this issue.

    Thanks in advance

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply