Reputation: 49
I have a table (Table 1) as below:
It is a Grid Matrix for shoe size.
I wanted to write an SQL statement to read from this Table 1 and display as below
I have run out of idea how to construct the SQL for this.
Upvotes: 0
Views: 66
Reputation: 33945
Create table my_new_table as
Select grid_code
,'size' attribute_type
, 1 attribute_code
, size_code_1 attribute_value
From my_table
Union
Select grid_code
,'size' attribute_type
, 2 attribute_code
, size_code_2 attribute_value
From my_table
... Etc
Upvotes: 1