分组查询出结果集,然后再根据结果集分组查询统计
我想分组查询出一个结果集,然后再根据结果集分组查询统计
比如有一个表A.字段有id,score,mark,record,dep,它们都是int型
我想以dep分组,每组里,要record最小。最后以record分组统计
数据如下
id score mark record dep
1 1.0 1.0 1 1
2 2.0 2.0 1 2
3 3.0 3.0 1 3
4 2.0 2.0 2 2
5 2.0 2.0 3 2
6 4.0 4.0 2 4
请各位大虾指点,谢谢了