Is there a way to get the lines through a query where the inner join compares a string of numbers with an integer? The integer is an ID and the string of numbers is the ID of that integer, but in string form.
Query:
SELECT
CT.ID, CEX.ID AS IDFiled, CAT.Name, CAT.ID AS IDCat
FROM
Field_Cat AS CT
INNER JOIN
C_Extra AS CEX WITH(NOLOCK) ON CT.IDCampoExtra = CEX.ID
INNER JOIN
Catg AS CAT WITH(NOLOCK) ON ',' + CT.IDCat + ',' LIKE CAT.ID
WHERE
CEX.ID = 1011
CT.IDCat = 4,8,12
I intend to get the rows from the CAT table where the id is 4,8,12.
With this query the result is null. Does anyone know how I can solve the problem?