Reputation: 1699
I have a column in my table of type SET('alpha','beta','gamma','delta','...','omega')
and name 'alphabet'
My PHP query is
$string = "gamma"
SELECT * FROM table WHERE alphabet LIKE "%$string%"
So I would like to return all of the rows where gamma
is in the column alphabet
, regardless of whar other values are in there too as it is a SET type.
What would the sql query be?
Upvotes: 3
Views: 964
Reputation: 204756
SELECT * FROM table WHERE find_in_set('$string', alphabet) > 0
Upvotes: 7