Combine rows / concatenate rows

后端 未结 5 2136
旧巷少年郎
旧巷少年郎 2020-11-22 16:53

I\'m looking for an Access 2007 equivalent to SQL Server\'s COALESCE function.

In SQL Server you could do something like:

Person

<         


        
5条回答
  •  日久生厌
    2020-11-22 17:04

    I think Nz is what you're after, syntax is Nz(variant, [if null value]). Here's the documentation link: Nz Function

    ---Person--- 
    John
    Steve
    Richard
    
    DECLARE @PersonList nvarchar(1024)
    SELECT @PersonList = Nz(@PersonList + ',','') + Person
    FROM PersonTable
    
    PRINT @PersonList
    

提交回复
热议问题