Tuesday, 7 April 2015

concatnet row in a singel row

select
    app.ID,
    stuff(
       (
           select '/ ' + AL.DomainCategoryName as DomainCategoryName
           from [tblPeriodPrice] as AL
           where AL.PeriodInYears = app.PeriodInYears
           for xml path(''), type
       ).value('.', 'nvarchar(max)')
    , 1, 2, ''),
    Name
from [tblPeriodPrice] as app

No comments:

Post a Comment