-- SELECT *  FROM employment_direction_recommend_table GROUP BY student_name HAVING count(student_name)>1;
-- SELECT * FROM employment_direction_recommend_table WHERE student_name in('东青梁','桑哲青')

-- 计算平均成绩及名次
SELECT a.student_name,

-- @lagfield as 上一个成绩,

case when a.`平均成绩`=@lagfield then @rowNum else (@rowNum:=@rowNum+1) END as `排名`,

@lagfield:=a.`平均成绩` as 成绩

-- (@rowNum:=@rowNum+1) as `名次`   
FROM(
select student_name,
round((avg(required_synthesize)+avg(major_synthesize)+avg(synthesize_appraisal))/3,2) as `平均成绩`
from employment_direction_recommend_table b GROUP BY student_name order by `平均成绩` desc
) a,(SELECT (@rowNum :=0)) b,(select @lagfield:=0) r

  

相关文章:

  • 2022-02-16
  • 2022-12-23
  • 2021-04-22
  • 2021-04-27
  • 2021-07-10
  • 2022-12-23
  • 2022-02-06
猜你喜欢
  • 2022-01-11
  • 2022-02-23
  • 2021-12-27
  • 2022-12-23
  • 2021-11-19
  • 2022-12-23
  • 2021-12-17
相关资源
相似解决方案