Possible Duplicate:
Parameterizing an SQL IN clause?
Is it possible to use a variable in a IN clause to get the wanted results ?
hard-coded example;
SELECT 1 FROM `test` WHERE test_name IN ('Test1', 'Test2');
Desired solution:
SET @test_names = 'Test1, Test2';
SELECT 1 FROM `test` WHERE test_name IN (@test_names);
Or is there some other way to achieve this ?
SOLUTION:
SET @test_names = 'Test1,Test2';
SELECT 1 FROM `test` FIND_IN_SET(test_name, @test_names);
Notice that the @test_names does not have any spaces in it !