Re: Split the result of a query in 2 rows
От
David G Johnston
Тема
Re: Split the result of a query in 2 rows
Дата
Msg-id
CAKFQuwZZdRf3tsmOgDQhMV0B5_-H2d9m6Nb2jnV_vFeoHO2O3w@mail.gmail.com
Ответ на
Re: Split the result of a query in 2 rows (Frank Pinto)
Список
Дерево обсуждения
Split the result of a query in 2 rows JORGE MALDONADO <jorgemal1960@gmail.com>
Re: Split the result of a query in 2 rows David G Johnston <david.g.johnston@gmail.com>
Re: Split the result of a query in 2 rows Yaser Raja <yrraja@gmail.com>
Re: Split the result of a query in 2 rows Frank Pinto <frank@ayalo.co>
Re: Split the result of a query in 2 rows David G Johnston <david.g.johnston@gmail.com>
Re: Split the result of a query in 2 rows Frank Pinto <frank@ayalo.co>
Re: Split the result of a query in 2 rows David G Johnston <david.g.johnston@gmail.com>
Re: Split the result of a query in 2 rows Marcos Almeida Azevedo <marcos.al.azevedo@gmail.com>
So:If the original result set returned 1 row with 2 columns the new solution would return 2 rows with 1 column?If the original result set returned 100 row with 3 columns the new solution would return 300 rows (1 row gets turned into 3 rows * 100 rows = 300)?I would use unnest. Something like this (untested):
WITH temp_table AS (SELECT ARRAY(SELECT field1, field2 FROM tbl_table ORDER BY field1) AS prepared_fields;)SELECT UNNEST(prepared_fields) FROM temp_table;
I would suggest you test this...
David J.
View this message in context: Re: Split the result of a query in 2 rows
Sent from the PostgreSQL - novice mailing list archive at Nabble.com.
В списке pgsql-novice по дате отправления