Hello All,
Can you tell me what is the MSSQL Equivalent of List Tag?
What I want to achieve is concat all the ID base on its Code.
Example
Code | ID
001 | 80011,80010,80003
002 | 80014,80026,80031
Here is the sample code that I made.
select
distinct
b.Emt_CostCenterCode,
stuff((select','+ Emt_EmployeeID from T_EmployeeMaster a where a.Emt_EmployeeID = b.Emt_EmployeeID For XML PATH('')),1,1,'')
from T_EmployeeMaster b
group by b.Emt_CostCenterCode,b.Emt_EmployeeID
Please help.
Thanks