How to concatenate strings of a string field in a PostgreSQL 'group by' query?

前端 未结 14 1408
北荒
北荒 2020-11-22 02:37

I am looking for a way to concatenate the strings of a field within a group by query. So for example, I have a table:

ID   COMPANY_ID   EMPLOYEE
1    1               


        
14条回答
  •  情深已故
    2020-11-22 03:07

    This latest announcement list snippet might be of interest if you'll be upgrading to 8.4:

    Until 8.4 comes out with a super-effient native one, you can add the array_accum() function in the PostgreSQL documentation for rolling up any column into an array, which can then be used by application code, or combined with array_to_string() to format it as a list:

    http://www.postgresql.org/docs/current/static/xaggr.html

    I'd link to the 8.4 development docs but they don't seem to list this feature yet.

提交回复
热议问题