Maybe answer is very easy, but I can’t find the right MySQL query which do what I want.
I have table user :
| id_user | name | action_type |
+---------------------------------+
| 1 | joshua | 1,13,12,40 |
| 2 | joshua | 2,8 |
And I want to select only rows which have exact number in action_type column.
action_type is stored in MySQL as TEXT.
I’ve tried this:
SELECT * FROM user WHERE action_type LIKE '%2%'
But it selected rows with 12 which is not what I want 🙁
Maybe it’s possible with IN operator, but I couldn’t find a right way to use this.
You are looking for
FIND_IN_SETSQL Fiddle DEMO
UPDATE
Just to mentioned it, this is also possible
MySQL will do an automatic conversion to char