Find Rows in Vertical Line-separated values in MySQl?

Posted by Trez on Stack Overflow See other posts from Stack Overflow or by Trez
Published on 2010-04-18T08:57:48Z Indexed on 2010/04/18 9:03 UTC
Read the original article Hit count: 308

Filed under:
|

Let say i have a field 'category' with the value '1|2|3'. I want to search in mysql such that it will return all rows matching my search parameter into the values of the category. for example:

$cat_id = 1;

SELECT * FROM `myTable` WHERE cat_id is equal or found in category with values '1|2|3'...

something like that..i do not know how to put it in correct sql query.

Any Ideas? thanks in advance.

© Stack Overflow or respective owner

Related posts about mysql

Related posts about php