We help IT Professionals succeed at work.
Get Started

Column in database with multiple values - need to classify

Last Modified: 2020-01-01
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!
Watch Question
Most Valuable Expert 2012
Distinguished Expert 2020
This problem has been solved!
Unlock 1 Answer and 4 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE