Sybase ASE 15 Aggregate Function for strings

前端 未结 2 1265
清酒与你
清酒与你 2021-01-21 10:31

I\'am findind a way to aggregate strings from differents rows into a single row in sybase ASE 15. Like this:

id | Name                    Result: id | Names
--          


        
2条回答
  •  渐次进展
    2021-01-21 11:24

    Sybase ASE does not have any string aggregate functions like list() or group_concat(); and while there is some support for FOR XML, it does not include support for the PATH option/feature.

    Assuming you could have an unknown/variable number of rows to append, your only (ASE 15) T-SQL option would be a cursor-based solution.

    If you find yourself working with ASE 16 you could write a user-defined function (UDF) to accomplish the task, eg: emulate group_concat() in ASE 16

提交回复
热议问题