[MSSQL] GROUP BY 시 특정행 값 콤마로 구분하여 합쳐 보기
FOR XML 과 STUFF 함수를 이용한 간단한 예제 ; SELECT Name, Code, Spec, STUFF((SELECT ',' + CONVERT(VarChar(50) , Qty) FROM ResultTable AS B WHERE A.Spec = B.Spec FOR XML PATH ('')),1,1,'') AS Qty FROM ResultTable AS A GROUP BY Spec,Name,Code
2015. 4. 29.