Re: looking for alternative to MySQL's GROUP_CONCAT function
| От | David Fetter |
|---|---|
| Тема | Re: looking for alternative to MySQL's GROUP_CONCAT function |
| Дата | |
| Msg-id | 20051021202509.GA23082@fetter.org обсуждение исходный текст |
| Ответ на | looking for alternative to MySQL's GROUP_CONCAT function (<x3v0-pgsql@yahoo.com>) |
| Список | pgsql-general |
On Fri, Oct 21, 2005 at 11:58:07AM -0700, x3v0-pgsql@yahoo.com wrote: > Hi all, > > I'm looking into PostgreSQL. Coming from a MySQL background, I have > made heavy use of its very useful GROUP_CONCAT function. You can > read about the function here: > > http://dev.mysql.com/doc/refman/4.1/en/group-by-functions.html > > Is there a PostgreSQL alternative to GROUP_CONCAT? There's a more flexible one :) Use the array_accum() aggregate as described here http://www.postgresql.org/docs/current/static/xaggr.html and wrap it with array_to_string() http://www.postgresql.org/docs/current/static/functions-array.html to get a nice, flexible system. You can make a static one if you like. One thing about this approach is that you then have to exclude NULLs from your search because PostgreSQL arrays can't yet hold NULLs. Cheers, D -- David Fetter david@fetter.org http://fetter.org/ phone: +1 510 893 6100 mobile: +1 415 235 3778 Remember to vote!
В списке pgsql-general по дате отправления: