I have a table (user) with a field named membergroupids which contains multiple values seperated by a comma.
The field type is varchar and will contain muiltiple member group id numbers.
Administrators group is 1
registered is 2
site users is 3
private group is 4
the field can contain this data in random entry.
one record could be 3,4
two could be 1,4
thre could be 4,3
4 could be 2,4
I am trying to figure out the sql statement that would select all records in the table that contain a 4 and ordered by userid.
examples I have tried :
SELECT * FROM user WHERE membergroupids IN (4) = 4 order by userid ASC
SELECT * FROM user WHERE membergroupids >= 4 order by userid ASC
SELECT * FROM user WHERE membergroupids IN ('4') = 4 order by userid ASC
Thank you in advance for your quick response.