MySQL using function IN with variable
- by misanov
I have problem querying table with variable in IN function.
SELECT
s.date,
(SELECT
GROUP_CONCAT(value)
FROM value
WHERE id_value
IN(s.ref_values)
)
AS vals
FROM stats s
ORDER BY s.date DESC
LIMIT 1
Where s.ref_values is '12,22,54,15'. I get only one return for first number (12).
When I insert that value directly in IN(12,22,54,15) it finds all 4.
So, there must be problem with using variable in IN. What am I doing wrong?