The following works as expected when there is a single value stored in a variable.
SET @a := "20100630";
SELECT * FROM wordbase WHERE verified = @a;
But it does not work when there are multiple values stored in a variable.
SET @a := "'20100630', '20100701' ";
SELECT * FROM wordbase WHERE verified in (@a);
Do I need to use prepared statements for this?
You cannot (as far as I am aware) store multiple values in a MySQL user defined variable. What you have done is create a string which contains:
That is not two separate values, but a single string value, just as this is a single string value:
You need to use two separate variables, or prepare a statement, like this:
But that’s kinda messy. Why do you need to use variables?