i need to create a temporary table which column name will generate dynamically using a select command (mean: the value of another table.). But when i run the command then the temp table created with the value not the column name. i have tried as below:
SELECT ColVal FROM tableA
TableA
------------------------
ColName | ColVal
------------------------
id | 1
----------------------
Name | Test
----------------------
Age |25
---------------------
Now , i need to create Temp table B which column name will be as below
TableB
--------------
id| Name| Age|
--------------
I have tried by the query:
CREATE TEMPORARY TABLE TableB as (select ColName from TableA)
it's not give me the actual output. it create the table like:
TableB
-----------------
ColName
-----------------
id
--------
Name
--------
Age
--------