I have a database that has a table that has different LIKES that people have. Each like is stored as a different record. The only info I have in each record is userID, likeID.
The search will be based on the current userID that is signed in. So I'm not matching EVERYONE with EVERYONE but instead matching EVERYONE vs 1
So userID 45 might have likeID 3, likeID 6 and likeID 22 in the table (for instance)
What I want to do is have the table return, in descending order userIDs that they match with based on the total likes they match with someone else.
For example, (based on user 45 example above) it would look at userID 1 and see how many of likeID 3, likeID 6 and likeID 22 they have. then it'd go to userID 2 and see how many of likeID 3, likeID 6 and likeID 22 they have.....it'd do this for everyone.
Then it'd show the results for any that have more than 0 matches for those 3 likeIDs:
Matches:
You and UserID 12 share 3 of the same likes.
You and UserID 87 share 3 of the same likes.
You and UserID 22 share 2 of the same likes.
You and UserID 73 share 2 of the smae likes.
You and UserID 71 share 1 of the same likes.
etc...
I hope that explains what I'm trying to do. I don't think the mySQL query will be too hard but right now I'm baffled at how to do it!
THANKS IN ADVANCE!