I'm looking for some help with a problem I'm having. I have done a majority of the legwork but I just can't seem to get the last bit right.
I have added a SQL Fiddle example here to better demonstrate what I'm trying to do: http://sqlfiddle.com/#!9/2955fb/38
I have 3 tables, one is just a simple users table, another is a list of movies and the third is a list of which users have liked which movies.
Now I have created a query that returns only rows which match - for example, say I am user_id 1 (Dan), only return other users who have liked the same movies as me. This works fine, it returns the persons name and which movie is matched to mine - my problem is I want a third column with an overall count of how many movies I've matched on with that user.
In the example I give, me and Ash have 2 films in common, whereas me and Sam have 3. I'd like to be able to group by user_id (to remove duplicates), and then order by the amount of movies we have in common - if that makes sense?
I hope someone can help me as spent a good few hours getting this far. If I haven't explained well, please let me know and I will elaborate.