数据如下
class | name | score | student_id | subject
---------------+---------------+---------------+---------------+---------------
1 |张三 |85.5 |1 |Math
1 |张三 |83.5 |1 |yuwen
1 |张三 |84.0 |1 |English
1 |李四 |92.0 |2 |English
1 |李四 |99.0 |2 |Math
1 |王五 |92.0 |3 |English
2 |2张三 |87.0 |4 |Math
2 |2张三 |80.0 |4 |yuwen
2 |2张三 |84.0 |4 |English
2 |2李四 |92.0 |5 |English
2 |2李四 |99.0 |5 |Math
2 |2王五 |92.0 |6 |English
我需要查询每个班级 总分第一名的人和总分,查询结果为
class name student_id sum
1 |张三 |1 |253.0
2 |2张三 |4 |251.0
这中查询怎么写啊
class | name | score | student_id | subject
---------------+---------------+---------------+---------------+---------------
1 |张三 |85.5 |1 |Math
1 |张三 |83.5 |1 |yuwen
1 |张三 |84.0 |1 |English
1 |李四 |92.0 |2 |English
1 |李四 |99.0 |2 |Math
1 |王五 |92.0 |3 |English
2 |2张三 |87.0 |4 |Math
2 |2张三 |80.0 |4 |yuwen
2 |2张三 |84.0 |4 |English
2 |2李四 |92.0 |5 |English
2 |2李四 |99.0 |5 |Math
2 |2王五 |92.0 |6 |English
我需要查询每个班级 总分第一名的人和总分,查询结果为
class name student_id sum
1 |张三 |1 |253.0
2 |2张三 |4 |251.0
这中查询怎么写啊
3 个回复
wulI
赞同来自: liaosy 、Kevin_23
wulI
赞同来自: Kevin_23
Kevin_23 - 渣渣源
赞同来自:
但是查询结果 不知道再怎么查询 总分第一的。