We help IT Professionals succeed at work.
Get Started

query syntax (INNER JOIN)

Aleks asked
Last Modified: 2021-04-21
I have a table that saves comma separated values, such as :  1,3,5
This values are the ID of records on a different table, called "Admintags"

When I add a record for a 'casecomment' one of the columns is called 'tags'  and this is where I save those comma separated values.

I have the following query:

			a.CaseID ,
    FROM    dbo.Casecomments a

Open in new window

That will return the following values:
caseid  | tags  | comment
30638  |  1, 5  | Client will be traveling to Mexico City from Dec 15th until Jan 2nd.

What I need the query to return is the value of those tags from the 'tags' table. The tags table is very simple, it only has two columns
id = the ids saved above
tag_text = the text value of the tag, this is what I need in return:

30638 |  Travel date, Billing | Client will be traveling to Mexico City from Dec 15th until Jan 2nd.

which are the corresponding values of 1 and 5 in the "Admintags" table.

1	Travel Date
2	Agreement
3	Billing
4	Contact method
5	Email 

Open in new window

How can I do an inner join to display those values instead of the ID's that I have in the casecomments table ?
Watch Question
Data Engineer
This problem has been solved!
Unlock 1 Answer and 18 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