I have a table with 31 columns which contain values for each day in a month and I want to create a tranpose table like the example below. Real Real data in the database is really big so I don't expect to use Excel to solve this problem. Can Can this be done by using sqlSQL or is there any tool that can do this? Thank you.
[Original table]Original table
- ID price_date_1 price_date_2 ... price_date_30 price_date_31
- A 1 2 ... 0 1
- B 2 3 ... 1 2
+----+--------------+--------------+-----+---------------+---------------+
| ID | price_date_1 | price_date_2 | ... | price_date_30 | price_date_31 |
+----+--------------+--------------+-----+---------------+---------------+
| A | 1 | 2 | ... | 0 | 1 |
| B | 2 | 3 | ... | 1 | 2 |
+----+--------------+--------------+-----+---------------+---------------+
[New Table]New table
- Price A B
- price_date_1 1 2
- price_date_2 2 3
- ......
- price_date_30 0 1
- price_date_31 1 2
+---------------+---+---+
| Price | A | B |
+---------------+---+---+
| price_date_1 | 1 | 2 |
| price_date_2 | 2 | 3 |
| ... | | |
| price_date_30 | 0 | 1 |
| price_date_31 | 1 | 2 |
+---------------+---+---+