troubleshooting Question

Column in database with multiple values - need to classify

Microsoft SQL ServerSQL
4 Comments1 Solution65 ViewsLast Modified:
Hello all,

I have a database called 'Customer' within it I have a table called 'Product' and within this product table I have a column called 'Class' and ' Client'. Now this class column has single values and  numerous values in the column separated by a ; it looks like this:

Class      Client
1                   a
5                   b
6                   c
8;4                   d
7                   e
2                   f
1                   g
3                   h
2;1                   i
8;5;9;10       j
10                   k

what i am trying to accomplish is separate all of the classes  by client and apply a text value to the class. for example here is the text value I want to correspond with the numerical values under the class column. (unfortunately these text values are not in the database and I dont have permission to create a table).
Class      Poduct
1                cat
2                dog
3                 bird
4                fish
5                 tree
6                car
7                desk
8                TV
9               door
10               bike
11               radio
12               disk

This is what the desired output would look like.

Client      Class
a                cat
b                tree
c               car
d                TV
d                fish
e                desk
f                dog
g                 cat
h                bird
i                dog
i                cat
j                tree
j                TV
j                 door
j                bike
k                 bike

How would I do this? I am using Microsoft SQL Server Management Studio

Thank you!
Join our community to see this answer!
Unlock 1 Answer and 4 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 1 Answer and 4 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