I have a field: userids which contains 19,2,23 for example, which I populate based on user ids added to a room arbitrarily. I list the corresponding names based on these userids.
Right now I get Richard, Evan, James from this query (19 = Richard, 2 = Evan, 23 = James).
What I would like to do is sort the array (the field) upon query so that it is 2,19,23 and the names are returned Evan, Richard, James.
So a query that looks like this:
SELECT c.*,c.NAME as PAGE, ASORT(c.USERIDS) as USERIDS, p.*
FROM TBL_CONTENT c, TBL_PAGE p
WHERE c.PAGEID = p.ID AND FIND_IN_SET(?, c.USERIDS)
Should look like (help me with this query)?
of course, the ASORT function does not exist - I just include it as an example of what I am trying to do.
Any help here? Thank you!