Akansha Akansha - 2 years ago 85
SQL Question

Querying a table for various combinations

I have a table

enter image description here

The above table is the master table. I want to devide them based on caption - like all plan,content and accuracy to group based on parentid.

enter image description here

Need help me with this. Thanks

Answer Source

You can use a PIVOT for this.

    (SELECT ParentID, Caption, Name
        FROM #table) AS t
        FOR Caption IN ([Plan], [Content], [Accuracy])
    ) AS pvt
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download