With Postgresql I have the query:
select '1' , '2', '3';
with result
I would like to have next result:
column
1
2
3
How can I do that?
You are looking for Unpivot, then you can try to use UNION ALL
select '1' column
UNION ALL
SELECT '2'
UNION ALL
SELECT '3'
or you can try to use JOIN LATERAL
SELECT s.*
FROM test t
JOIN LATERAL (VALUES(t.a),(t.b),(t.c)) s(column) ON TRUE
I prefer to use a table function for that:
SELECT CAST(i AS text) FROM generate_series(1, 3) AS i;