AVG and COUNT in SQL Server

ben900

New Member
I have a rating system in which any person may review other. Each person can be judged by one person more than once. For the calculation of averages, I would like to include only the most current values??.Is this possible with SQL?
  • Person 1 rates Person 2 with 5 on 1.2.2011 <- ignored because there is a newer rating of person 1
  • Person 1 rates Person 2 with 2 on 1.3.2011
  • Person 2 rates Person 1 with 6 on 1.2.2011 <-- ignored as well
  • Person 2 rates Person 1 with 3 on 1.3.2011
  • Person 3 rates Person 1 with 5 on 1.5.2011
Result:
  • The Average for Person 2 is 2.
  • The Average for Person 1 is 4.
The table may look like this: \[code\]evaluator, evaluatee, rating, date\[/code\].Kind RegardsMichael
 
Back
Top