SQL query join

I would like to pull these two tables together to I can list by date what tests were given, and also display the name of the test given.

 Table: CompanyTests Table: Tests
rrhandle8Asked:
Who is Participating?
 
Ephraim WangoyaConnect With a Mentor Commented:
here

select companytest.*, tests.*
from companytests
inner join tests on charindex(cast(tests.tid as varchar), companytest.tests) > 0
0
 
Ephraim WangoyaCommented:
if the test ids are always three characters, you can join using charindex

select companytest.*, tests.*
from companytests
inner join tests on charindex(cast(tid as varchar), tests) > 0
0
 
HainKurtConnect With a Mentor Sr. System AnalystCommented:
to be on safe side:

select companytest.*, tests.*
from companytests
inner join tests on charindex(',' + cast(tests.tid as varchar) + ',', ',' + companytest.tests +',') > 0

this will search ",700," in ",700,701,720,721,"
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.