Hello StackOverflow Community,
I have question regarding the best method (in terms of resources/speed/etc.) to find where a defined valued is in an imploded string that is stored in a cell in the database.
ie: (all elements in table are either INT or STRING)
id | age | name | groups
0 | 28 | bob | 1,2,3,4
1 | 33 | sara | 1,4
Given the requested group would be 2,
Would it be best to select all users and iterate through their groups manually to see if it matches to 2. (which doesn't sound resourceful at all)
or is there a way to do a
constant IN array query via MySQL
SELECT * FROM tableUsers WHERE 2 IN groups
which would select user id with 0.
^ obviously that won't work but is there a similar alternative?