Answer the question
In order to leave comments, you need to log in
How to use string as column name?
There is a table that looks like this:
first | second | third
-----------------------
first | second | third
ab | ba | cd
1 | 2 | 3
Is it possible to somehow change the names of the first, second, third columns to ab, ba, cd with one query?
It is difficult to do this manually, because there are many such columns in the table .
UPD .
Maybe something interesting will tell you how best to implement the work with this table?
Now I want that where there is a group number in the 3rd line, this number could be used as a column name. Or is it better to transpose the table?
Answer the question
In order to leave comments, you need to log in
SELECT first AS ab, second AS ba, third AS cd FROM table
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question