I have a table similar to:
+------+----------+----------+----------+----------+
| Name | Subject1 | Subject2 | Subject3 | Subject4 |
+------+----------+----------+----------+----------+
| x | 10 | 11 | 12 | 13 |
| y | 20 | 21 | 22 | 23 |
| z | 30 | 31 | 32 | 33 |
+------+----------+----------+----------+----------+
And I need to get an output:
Name Subject Mark
-------------------------------
x Subject1 10
x Subject2 11
x Subject3 12
x Subject4 13
y Subject1 20
y Subject2 21
y Subject3 22
y Subject4 23
z Subject1 30
z Subject2 31
z Subject3 32
z Subject4 33
I need a dynamic query,because the number & name of the column keep changing from table to table. There are min 56 columns in each table. Likewise, i have 5 tables.