首页 > 代码库 > sql逗号

sql逗号

1.原始

技术分享
2.利用语句

SELECT  B.tablename ,
        LEFT(StuList, LEN(StuList) - 1) AS ArrayList
FROM    ( SELECT    tablename ,
                    ( SELECT    columnname + ‘,‘
                      FROM      DataService
                      WHERE     tablename = A.tablename
                    FOR
                      XML PATH(‘‘)
                    ) AS StuList
          FROM      DataService A
          GROUP BY  tablename
        ) B

技术分享

sql逗号