使用 SQL的 for xml path来进行字符串拼接 (group by)

参考:

http://www.cnblogs.com/repository/archive/2011/01/18/1938418.html

 

select convert(varchar(10),c.[STARTSPECDAY],120),

   (select [LeaveName]+‘ ‘ 
      from 
      (
        select convert(varchar(10),a.[STARTSPECDAY],120) STARTSPECDAY,a.[LeaveName] 
        from  [test].[dbo].[View_GetSPDay]  as a

      ) as b 
     
     where convert(varchar(10),c.[STARTSPECDAY],120)=convert(varchar(10),b.[STARTSPECDAY],120) for xml path(‘‘)

   ) as course_name

    from [test].[dbo].[View_GetSPDay]  as c  
    
    group by convert(varchar(10),c.[STARTSPECDAY],120)

  使用 SQL的 for xml path来进行字符串拼接 (group by)

使用 SQL的 for xml path来进行字符串拼接 (group by)

上一篇:Mysql读写分离(mysql-proxy)


下一篇:【jdbc】spring