SELECT mysql column with comma separated values -


consider have table this.

 +-------------+---------------+----------------+---------------+ +     id      +    column 1   +    column 2    +    column 3   + +-------------+---------------+----------------+---------------+  +      1      +     values    +     values     + a, b, c, d, e +   +-------------+---------------+----------------+---------------+ 

my query can this

select * table column 1 = 'values' , column 3 = '$variable' 

the $variable can e

is there way use query select row want?

use find_in_set() -- builtin function mysql search string

select  *    tablename column 1 = 'values' ,  find_in_set('a',column 3 )>0 

Comments