I have a large file that has the following fields:
Table 1:
+---------+--------+-----------+
| User_Id | Key_Id | Value     | 
+---------+--------+-----------+
| 100     | 74     | 37        |
| 100     | 65     | Male      |
| 100     | 279    | G235467   |
+---------+--------+-----------+
and I have another file that tells what each 'Key_Id' is called (they are column names) e.g.
Table 2:
+--------+------------------+
| Key_Id | Key              |
+--------+------------------+
| 65     | Gender           |
| 66     | Height           |
| 74     | Age              |
| 279    | ReferenceNo      |
I want to create a table using the Key_Id names found in the Key column of table 2, transpose all of the values from table 1 into table 2, but also include the User_Id from table 1 as this relates to an individual.
PS. Table 2 has nearly 300 keys that would need turning into individual fields
So ultimately I would like a table that looks like this:
+---------+---------+--------+-------+--------------+--------+
| User_Id | Gender  | Height | Age   | ReferenceNo  |  etc   |
+---------+---------+--------+-------+--------------+--------+
| 100     | Male    |        | 37    | G235467      |        |
So that each User_Id is a row and that all the Keys are columns with their respective values
 
     
     
    