title: Mysql query for getting profiles with similar interests
body: <p>I'm looking for some help with a problem. I've a table with the following columns/fields -</p>
  <p><em>COLUMNS</em> = <strong>userName</strong> | <strong>userEmail</strong> | <strong>userInterests</strong> | .... and other fields</p>
  <p><em>VALUE</em> = userA | userA@email.com | 1,2,10</p>
  <p><em>VALUE</em> = userB | userB@email.com | 15,27,9,7,2</p>
  <p>userName(varchar) = the primary key</p>
  <p>userEmail(varchar) = user's email</p>
  <p>userInterests(varchar) = comma separated numbers for interests. I've mapped these number to their actual value (interests) in PHP script. e.g. 1 - Painting, 2 - Dancing and so on...</p>
  <p>Now I'm trying to find the users having the similar interests. The number of interests a user can have can vary. My goal is to find the best match for any user.</p>
  <p>Suppose if User A has 3 interests and User B has 5 interests, from which 1 interest is common in both user, so I wanna get the matched user's name. Suppose if there's another user with 2 common interests, then in that case, return that profile. In General, I wanna find the best match (where all interests meet with other user), if not, then second best match (at least have 2 or 1 common interest).</p>
  <p>I have already been to this solution but I'm unable to get the desired output. There's only one table, so I can't use the joins as well.
  <a href="https://stackoverflow.com/questions/59561972/sql-finding-users-with-similar-interests">SQL - Finding Users with Similar Interests</a></p>
  <p>Please help me with this, I've been meddling with this from past 2 days and couldn't find the right solution. I tried my best to explain the problem, If I failed to do so, Please let me know and I can elaborate. Thanks</p>