Is it possible in mysql to use IN statement with varchar column
In my case
SELECT `custids` FROM user WHERE id = 1;
It returns custids column which is varchar and values are comma seperated like 1,2,3
When I run this query
SELECT * FROM `user` WHERE user.id IN(`custids`);
It is not running like I expected.
Actually I am to run query like :
SELECT * FROM `user` WHERE user.id IN(1,2,3);
But I think it is running like :
SELECT * FROM `user` WHERE user.id IN('1,2,3');
If you are unable to build query with 1,2,3 instead of ‘1,2,3’ you may try to use FIND_IN_SET
http://dev.mysql.com/doc/refman/5.5/en/string-functions.html#function_find-in-set