| От | Tom Lane |
|---|---|
| Тема | Re: Combining several rows |
| Дата | |
| Msg-id | 10852.1085406596@sss.pgh.pa.us обсуждение |
| Ответ на | Combining several rows (Matthias Nagl <pg@mnagl.de>) |
| Список | pgsql-general |
Matthias Nagl <pg@mnagl.de> writes: > Let's say I've got a table in the following form: > SELECT * FROM test; > id | name > ----------- > 1 | abc > 2 | def > 3 | ghi > For a table like this I am looking for a query that returns a result that > looks this way: > name > ------------- > abc, def, ghi The easy way to do this is with a user-defined aggregate. I believe there are several threads in the mailing list archives that give solutions to exactly this problem. I tried "create aggregate comma" at http://www.pgsql.ru/db/pgsearch/ and got this as the first hit: http://archives.postgresql.org/pgsql-sql/2003-03/msg00381.php regards, tom lane
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера