DECLARE @table TABLE(
aaaa(컬럼명) tinyint(컬럼타입),
bbb,
ccc
)
INSERT INTO @table (aaa, bbb, ccc)
SELECT DISTINCT aaa, bbb, ccc FROM table
SELECT DISTINCT A.aaa, A.bbb
FROM @table A
SELECT DISTINCT
BusinessDT
, '[' + STUFF((SELECT DISTINCT ',' + CONVERT(NVARCHAR, bbb)
FROM @table
WHERE aaa = Z.aaa
FOR XML PATH('')), 1, 1, '') + ']' bbb
FROM @table Z
WHERE 조건