分类:mysql

mysql里的求平均数 并保留小数点

mysql里的求平均数 并保留小数点
SELECT CAST(AVG( complete_speed ) as decimal(10,2)) as complete_speed,
CAST(AVG( complete_quality ) as decimal(10,2)) as complete_quality ,
CAST(AVG( work_bearing ) as decimal(10,2)) as work_bearing ,
be_marked_user_id , u.first_name , CAST(AVG((complete_speed+complete_quality+work_bearing)/3) as decimal(10,2)) as average
FROM mark_pointresult r left join auth_user u
on u.id=r.be_marked_user_id
GROUP BY be_marked_user_id

查看详情