0

I have a table, say Maintable like this.

enter image description here

I want to view this table like this:

enter image description here

How can this be achieved using dynamic SQL?

Cherylaksh
  • 248
  • 5
  • 20
  • did you write some code .? – SANDEEP Jun 06 '20 at 10:25
  • All of those duplicates give you the answer on how to pivot your data, however, [SQL server : Convert rows into columns](https://stackoverflow.com/questions/16589282/sql-server-convert-rows-into-columns) is very likely the one you want here (just with a `GROUP BY` which the others teach you). [Convert rows to columns in SQL](https://stackoverflow.com/questions/13663264/convert-rows-to-columns-in-sql) demonstrates it well though and includes a dynamic approach. – Thom A Jun 06 '20 at 10:29
  • If you try, and failed to implement to solution, the post a new question with **consumable** data (not images) and show your attempt(s) and explain why they didn't work. – Thom A Jun 06 '20 at 10:31

0 Answers0