Hi everyone!
I've been looking for a solution, but i just can't find it anywhere...
Ok, so the problem is:
i have a database which looks something like this:
user_id product_id score
14 . 235 . 79
23 . 235 . 32
53 . 665 . 21
14 . 235 . 90
5 . 675 . 45
This is step-by-step of what i need to do:
1. Select user - user_id =343
2. For user_id =343 select all products that he gave score to:
product_id = 43 - score = 99
product_id = 12 - score = 56
product_id = 68 - score = 32
product_id = 124 - score = 67
3. Find all users that voted for the same products e.g.:
for product_id = 43:
user_id = 125 voted 93 points,
user_id = 23 voted 56 points.
4. Calculate the difference between the score of user, so:
for product_id = 43:
user_id = 125 voted 93 points (99 - 93 =6 points of diff.)
user_id = 23 voted 56 points (99 - 56 =43 points of diff.)
return the results....
That's basically what i need to do. I still don't know the number of the users, or product, but it doesn't really matter - i just need to make it work.
Ok, hope someone can help!