April 18, 2021

WeAnswer

The complete guide to the beginners as well as to the experienced Web Developers

Compare comma-separated field with single string

Ex I want to a value of 2 in that field. The comma separated saved in a group_id and I don’t want to match 3 or 4

Table name : tbl_user

user_id group_id created updated
3 1,2,3,4 2016-07-19 15:09:09 2016-07-19 15:09:09
2 3,4 2016-07-19 15:08:09 2016-07-19 15:08:09
1 1 2016-07-19 15:08:07 2016-07-19 15:08:07

Mysql Query :