PIVOT / UNPIVOT IN SQL 2008

Posted by Nev_Rahd on Stack Overflow See other posts from Stack Overflow or by Nev_Rahd
Published on 2010-04-20T23:37:30Z Indexed on 2010/04/20 23:43 UTC
Read the original article Hit count: 363

Filed under:
|
|

Hello

I got child / parent tables as below.

MasterTable:

MasterID, Description

ChildTable

ChildID, MasterID, Description.

Using PIVOT / UNPIVOT how can i get result as below in single row. if (MasterID : 1 got x child records)

MasterID, ChildID1, Description1, ChildID2, Description2....... ChildIDx, Descriptionx

Thanks

© Stack Overflow or respective owner

Related posts about pivot

Related posts about unpivot