Re: Window ?
От | David G. Johnston |
---|---|
Тема | Re: Window ? |
Дата | |
Msg-id | CAKFQuwY2E1GUmOoNDo-UdxiOSg4gErdpmzDYV5zRJ6JhBO60Uw@mail.gmail.com обсуждение исходный текст |
Ответ на | Window ? (Olivier Leprêtre <o.lepretre@gmail.com>) |
Ответы |
RE: Window ?
|
Список | pgsql-sql |
I want to convert records into lines,
1 att1 att2 att3 att4
2 att5 att6 ...
I would recommend either an actual array (array_agg function) or a structured string (string_agg function)
SELECT road, array_agg(colA ORDER BY seg)
FROM tbl
GROUP BY road;
Otherwise you will need a output 31 columns with unused columns holding null. You can do that brute-force or you can leverage the tablefunc extension's crosstab function.
David J.
В списке pgsql-sql по дате отправления: