Re: Window ?
От
David G. Johnston
Тема
Re: Window ?
Дата
Msg-id
CAKFQuwY2E1GUmOoNDo-UdxiOSg4gErdpmzDYV5zRJ6JhBO60Uw@mail.gmail.com
Ответ на
Window ? (Olivier Leprêtre)
Список
Дерево обсуждения
Window ? Olivier Leprêtre <o.lepretre@gmail.com>
Re: Window ? "David G. Johnston" <david.g.johnston@gmail.com>
RE: Window ? Olivier Leprêtre <o.lepretre@gmail.com>
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 по дате отправления