Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-683

String aggregates

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • None
    • 1.20.0
    • None
    • None

    Description

      Per http://www.sql-workbench.net/comparison/string_aggregates.html, aggregate multiple string values to a single value, optionally delimited.

      select d.department_id, 
             d.department_name, 
             string_agg(e.first_name, ',' order by first_name) as all_employees
      from departments d
        join employees e on d.department_id = e.department_id
      group by d.department_id
      order by d.department_id;
      
      department_id | department_name  | all_employees                                                                   
      --------------+------------------+-------------------------
                 10 | Road consruction | Prostetnic Vogon Jeltz                                                                          
                 20 | Hiking           | Arthur, Ford
                 30 | Shipping         | Zaphod
                 40 | Engineering      | Marvin, Tricia

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              julianhyde Julian Hyde
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: