troubleshooting Question

How to get the required out put - combining the values of multiple instances of a ID

Avatar of KavyaVS
KavyaVS asked on
Microsoft SQL Server 2008
7 Comments5 Solutions220 ViewsLast Modified:
Ex: I have a Table like this

ID  Code
1    A
1    U
1    C
2    B
2    V
2    T
3    C
3    K

I want the out put like this.If the code value is other than empty I want to display it in the result.
ID  Code
1   A;U;C
2   B;V;T

Select ID,

from Table dbo.a
Where ID in(1,2)

How to get the above out put.How will be the query.

Matt Bowler
Database Reliability Engineer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 5 Answers and 7 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 5 Answers and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros