2

该网站的不同用户正在给卖家评级。我想计算卖家百分比的积极反馈。我在我的反馈表中显示单个卖家的数据库,数据存储如下:

注意:可靠的最大值:5,通信最大值:5,经验最大值:3(1=差,2=一般,3=好)

用户对卖家的评价 可靠:4 沟通:5 经验:3

用户二对卖家的评价 可靠:5 沟通:1 经验:2

用户三对卖家的评价 可靠:5 沟通:5 经验:3

和其他用户评分将以这种方式进行

我如何计算卖家的正面反馈?

4

2 回答 2

3
select avg((reliable + communication + experience)/3) as feedback
from Feedbacktable  group by sellerid
于 2012-11-01T07:07:13.380 回答
0

把它当作

$total = 0
$avg = 0
foreach ($users as $user) {
   $user_avg = ($user['reliable'] + $user['communication'] + ($user['experience']/3) * 5) / 3;
   $total += $user_avg;
}
if (sizeof($users) > 0) {
  $avg = $total/sizeof($users);
  $avg = round($avg, 2)
}
于 2012-11-01T07:20:23.630 回答