I have a table with a column called "owners", this contains IDS for users who are associated with this particular record.
I am currently restricting data with ",". For example,
ID | Name | Owners
1 | Bob | 1,4,5
When making a selection on this, I intended to use the following SQL:
select * from table where owner='$profile' or owner like '%,$profile%' or owner like '%$profile,%'
but now I understand that this is spoiled (a search of 5 will match 5, 15, 25, even 50).
What would be the right way to do this?
source
share