I have a value say for example “1” and I Have column “grp_id” in my db table “tbl_grp“. This column “grp_id” contains the commaseperated values as example “1,2,3” I am looking for a way to compare my single value with column “grp_id“.
right now I am using the below query:
"SELECT user_id, user_fname, user_lname FROM tbl_grp WHERE grp_id='1'";
You could you
FIND_IN_SET:But the correct way to do this, instead of storing a comma-separated list of ids in a column, is to have a many-to-many association between your users and groups: