aggregate function to concatenate strings in Vertica

前端 未结 3 802
礼貌的吻别
礼貌的吻别 2021-01-13 02:43

have a table in vertica: test like this:

ID     |   name
1      |    AA
2      |    AB
2      |    AC
3      |    AD
3      |    AE
3      |    AF

3条回答
  •  情歌与酒
    2021-01-13 03:09

    The other method is to use GROUP_CONCAT from the strings package on github.

    select id, group_concat(name) over (partition by id order by name) ag
    from mytable
    

    However there are some limitations with this method since analytical udx won't allow you to include other aggregates (and you'll have to inline it or use with to add more data to it).

提交回复
热议问题