查找每個班級中成績最高的前三名

 Student 字段 name ,classid,score

class 字段 classid,name

 

select a.name,b.name as class,score

from student a,class b

where (select count(1) from student c where a.classid=c.classid and c.score>a.score )<=3

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章