troubleshooting Question

query syntax (INNER JOIN)

Avatar of Aleks
AleksFlag for United States of America asked on
Web DevelopmentMySQL ServerSQL
18 Comments1 Solution172 ViewsLast Modified:
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

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 

How can I do an inner join to display those values instead of the ID's that I have in the casecomments table ?
Sharath S
Data Engineer

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

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