Reputation: 233
if i write:
SELECT * FROM users WHERE themes LIKE '%3%'
from the field themes = '1, 2, 3, 4, 5', how to write right '%3' or '3%' or '%3%'
just to check if the user has selected one of those themes
Upvotes: 0
Views: 44
Reputation: 263693
use FIND_IN_SET
SELECT *
FROM users
WHERE FIND_IN_SET(3, themes) <> 0
Upvotes: 1