select ProjName,status from Project;
--for xml path('') 是把得到的内容以XML的形式显示。
--stuff(param1, startIndex, length, param2) 将param1中自startIndex(SQL中都是从1开始,而非0)起,删除length个字符,然后用param2替换删掉的字符。
select     
    ProjectName = (
        stuff(
            (select '' + ProjName from Project where Status = A.Status 
            for xml path('')),
            1,
            1,
            ''
        )
    ) 
from Project as A group by status;

 

sqlser 一列的多行内容拼接成一行中的一列

 

xml path('')用法这里也详解:https://www.cnblogs.com/yuer20180726/p/11365498.html

 

相关文章:

  • 2021-10-15
  • 2021-08-21
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-15
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-15
相关资源
相似解决方案