原始表
a b
1 a
2 b
3 c
DECLARE @combinedString VARCHAR(MAX) SELECT @combinedString = COALESCE(@combinedString + ', ', '') + a+ ', ' + b FROM tb1 select @combinedString
原始表
a b
1 a
2 b
3 c
DECLARE @combinedString VARCHAR(MAX) SELECT @combinedString = COALESCE(@combinedString + ', ', '') + a+ ', ' + b FROM tb1 select @combinedString