Given a table consisting of one row, I would like to transpose it into a table of one column. So basically, it is the inverse operation from what was asked in this question. I am using MEMSQL, but any SQL-like approaches are welcome.
So if my table looks like:
---------------------------------------------------------------------
| FirstName |Amount| PostalCode | LastName | AccountNumber |
---------------------------------------------------------------------
| John | 2.4 | ZH1E4A | Fork | 857685 |
---------------------------------------------------------------------
I am looking to get the following output:
--------------
| anyName |
--------------
| John |
| 2.4 |
| JZH1E4Aohn |
| Fork |
| 857685 |
--------------
EDIT: I am aware that this can be done using union all
, but using union all
can take lots of time if the row is long. I am looking for the most efficient way.