0

I have a below table that I like to convert the second column into rows based on first column.please see below screenshots.

Base Table:

enter image description here

Output Table:

enter image description here

Since I don't know the total rows of the columns so it is needed to apply dynamic sql. I can't figure it . can anyone please help me that would be very much appreciated.

Thanks Arfater

Arfater Rahman
  • 133
  • 1
  • 2
  • 10
  • If you have access to a presentation layer (e.g. PHP), it's best to do this kind of thing there. Otherwise this is a pivot query. Just search for 'mysql pivot prepared statement' and (possibly) 'stored procedure' – Strawberry Nov 27 '14 at 08:23
  • possible duplicate of [MySQL pivot table query with dynamic columns](http://stackoverflow.com/questions/12598120/mysql-pivot-table-query-with-dynamic-columns) – Strawberry Nov 27 '14 at 08:26

0 Answers0