MySQL using function IN with variable
Posted
by
misanov
on Stack Overflow
See other posts from Stack Overflow
or by misanov
Published on 2013-11-05T09:46:53Z
Indexed on
2013/11/05
9:53 UTC
Read the original article
Hit count: 131
mysql
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?
© Stack Overflow or respective owner