Sqlserver 文本数据两行变一行:
SELECT DISTINCT WWMLNM
FROM JDE_DV4R3.DV4R3DTA.F0111 WITH (NOLOCK)
WHERE RTRIM(LTRIM(WWAN8)) in (‘306’,‘312’)
SELECT DISTINCT (STUFF((SELECT ‘,’+RTRIM(LTRIM(WWMLNM))
FROM JDE_DV4R3.DV4R3DTA.F0111 WITH (NOLOCK)
WHERE RTRIM(LTRIM(WWAN8)) in (‘306’,‘312’)
FOR XML PATH(’’)),1,1,’’))