sql - Transposing Rows to Columns and having values flow down in TSQL -




i using tsql.

if have following results:

enter image description here

and want transpose this:

enter image description here

how can achieve this?

i have following query:

with q (     select *     tableone     id = 1     union     select m.*     tableone m     join on m.parentid = q.id ) select * q 

this gives me of items underneath specified node including specified node.

it easy if add scripting data , not image. note tbl name of table, called 3 times. try this:

select      a.fieldvalue company,      b.fieldvalue department,      c.fieldvalue job tbl  inner join tbl b on a.parentid null , a.id=b.parentid inner join tbl c on b.id= c.parentid 

if not bring desired results please add data text , let me know, modify query





wiki

Comments

Popular posts from this blog

python - Minimize function with Scipy minimize -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -