Anybody can help?

String_AGG is not workable?



Hi Jessica,


To aggregate strings, you should use the STUFF command (see how here).


ON your example, it would be something like this

SELECT
    STUFF((
        SELECT ',' + {Group}.[Description]
        FROM
            {Group_User}
        LEFT JOIN {Group} R ON {Group_User}.[Group_Id] = {Group}.[Id]
        FOR XML PATH('')), 1, 1, '')


Cheers,

João Marques

Thank Joao.


Jessica, in addition what João said, the reason string_agg is not working may be the version of your DB.


It was added in SQL Server 2017 (14.x) and later or SQL Azure. See microsoft docs about it


The stuff approach João commented is an alternative for other SQL versions

Thank Raphael.

May I know how to check the version of sql server in the cloud platform?

Jessica,

Try to create an Advanced SQL and TEST the following query:

EXECUTE('SELECT @@VERSION');


This way:


It should show you the version in test output: