Click here to Skip to main content
15,894,825 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Table

XML
Acc  Plan
101  A
101  B
101  C

i want result like 


Acc	 Plan
101	 A,B,C
Posted

 
Share this answer
 
Have a look at that


SQL
select Acc,
 stuff((Select ',' + cast(T1.Plan1 as varchar)
FROM #temp T1
WHERE T1.Acc = T.Acc
GROUP BY T1.Plan1 for xml path('')) ,1,1,'')
FROM #temp T
group by Acc
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900