If a user-defined variable @x
is a string of comma separated numbers, e.g. '1,2,4'
, is there a way to use it in an IN ()
function?
Specifically:
SET @x := '1,2,4';
SELECT * FROM t WHERE c IN (@x);
does not select rows in t where c equals 1 or 2 or 4.