Sort users by similar interests
<p>i have 2 tables like this:</p>

<p><strong>users:</strong></p>

<p>user_id|user_name</p>

<p><strong>interests:</strong></p>

<p>user_id|interest_id|interest_name</p>

<p>For example 'interests' is filled like this:</p>

<pre><code>123|1|Football
123|2|Swimming
123|3|Skiing
456|2|Swimming
...
</code></pre>

<p>Now i'm (user_id 123) logged in and i would like to know who has the most common interests like me (sorted descending).</p>

<p>The result should be something like this:</p>

<pre><code>User 1: 45 interests in common (and list them)
User 2: 23 interests in common (...)
User 3: 11 interests in common (...)
</code></pre>

<p>Any idea how to solve this?</p>

<p>I would perhaps read my interests first into an array and then do a loop or something?</p>

<p>Thanks!</p>