sql 将某一列转成字符串并且去掉最后一个逗号
DECLARE @center_JZHW VARCHAR(500) SET @center_JZHW = ( SELECT DISTINCT STUFF( ( SELECT ','''+ qudao+'''' FROM CreatedType WITH ( NOLOCK ) WHERE qtype = 'pc' ORDER BY qudao FOR XML PATH('')), 1,4, '') AS jzhw FROM CreatedType t) set @center_JZHW= left(@center_JZHW,len(@center_JZHW)-1) select @center_JZHW