📜  sql server:如何使用逗号连接列数据 - SQL 代码示例

📅  最后修改于: 2022-03-11 15:05:19.699000             🧑  作者: Mango

代码示例3
declare @aa varchar (200)
set @aa = ''

select @aa = 
    case when @aa = ''
    then CarName
    else @aa + coalesce(',' + CarName, '')
    end
  from Cars

print @aa