Using a comma seperated data in MYSQL "IN" clause

Posted by Sashi Kant on Stack Overflow See other posts from Stack Overflow or by Sashi Kant
Published on 2012-05-07T10:35:49Z Indexed on 2012/11/18 23:02 UTC
Read the original article Hit count: 223

Filed under:
|
|
|

I have a column in one of my table where I store multiple ids seperated by comma's. Is there a way in which I can use this column's value in the "IN" clause of a query.

The column(city) has values like 6,7,8,16,21,2

I need to use as

Select * from table where e_ID in (Select city from locations where e_Id=?) 

I am satisfied with Crozin's answer, but I am open to suggestions, views and options.

Feel free to share your views.

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql