MySQL Query for Average of last 2 attempts

后端 未结 5 1416
悲&欢浪女
悲&欢浪女 2021-01-23 07:27

I have a table:

quiz userid  attempt grade

1      3        1     33

2      3        1     67

1      3        2     90

10     3        4     20

2      3              


        
5条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-23 08:28

    SELECT AVG(grade), attempt
    FROM table
    GROUP BY attempt
    ORDER BY attempt DESC
    LIMIT 2
    

提交回复
热议问题