Listagg in Sqlserver
I'm Trying to Aggregate a 'String' Field in Sqlserver. I Would Like to Find the Same Function Listagg Like in Oracle. Do You Know How to Do the Same Function...
I'm trying to aggregate a 'STRING' field in SQLServer. I would like to find the same function LISTAGG like in Oracle .
Do you know how to do the same function or an another method?
For Example,
Field A | Field B
1 | A
1 | B
2 | A
And I would like that the result of this query will be
1 | AB
2 | A
4 Answers
Must Read
MySQL
SELECT FieldA
, GROUP_CONCAT(FieldB ORDER BY FieldB SEPARATOR ',') AS FieldBs
FROM TableName
GROUP BY FieldA
ORDER BY FieldA;