I have a table name Users
, each user has hobbies inside Hobbies
column. I want to find users
with matching hobbies
,
The hobbies are stored like this:
id | username | hobbies
1 | Ben | Hiking, Surfing
2 | Jane | Surfing,
3 | Dan | Reading
I want to sort the table by the matching user's hobbies - so the result will be something like :
HobbieName (Surfing) | id | username
| 1 | Ben
| 2 | Jane
Is it possible to do with MySql
query or should I sort the data by PHP
?