Hi
I am trying to create a feedback section of a website and trying to get the feedback scoring system working like this:
If a user receives a positive feedback then the users score increases by 1.
If the user receives a neutral feedback then it has no effect on the users score.
If a user gets a negative feedback then the users score is subtracted by 1.
All easy so far, but how do I only allow separate users to have an impact of only 1 on the users score, ie if the customer has 2 positive feedbacks then the customers score will only rise by 1.
It is basically the system Ebay uses I am trying to replicate and a description is here of the system
http://pages.ebay.co.uk/help/feedbac...ck-scores.html
But how am I going to create the query to only ever effect a users score by 1? Here is what I have so far, but it will only get the sum of the users score but not take into account the 'distinct' element I need from the 'from_username' column:
SELECT sum(feedback_score)
FROM feedback
WHERE feedback.to_username=thisuser
I have tried this:
SELECT DISTINCT(from_username)
FROM feedback
WHERE feedback.to_username=thisuser
that gets the distinct usernames from the table, but how do I combine the 2 queries to get the desired result?
Sorry for the length of the post
TIA
David