
在mysql中,order by查询的问题
在一张表中有学生的考试信息表中课程ID与课程表关联课程有语文,数学,英语,要求查询出每门课程的前三名(查询的是考试信息表)我知道用select*fromexamorder...
在一张表中有学生的考试信息表中课程ID与课程表关联
课程有语文,数学,英语,
要求查询出每门课程的前三名(查询的是考试信息表)
我知道用select * from exam order by kechengID (但是每门课程的前三名
不知道怎么查询) 展开
课程有语文,数学,英语,
要求查询出每门课程的前三名(查询的是考试信息表)
我知道用select * from exam order by kechengID (但是每门课程的前三名
不知道怎么查询) 展开
展开全部
select t1.kechengID, t1.chengji
from exam as t1
join exam as t2 on t1.kechengID=t2.kechengID and t1.chengji<=t2.chengji
group by t1.kechengID, t1.chengji
having count(*)<=2;
先试一下,应该没问题
from exam as t1
join exam as t2 on t1.kechengID=t2.kechengID and t1.chengji<=t2.chengji
group by t1.kechengID, t1.chengji
having count(*)<=2;
先试一下,应该没问题
展开全部
select * from exam where kechengID = '课程' order by kechengID limit 0,3;
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
select top(3) from exam order by kechengID???
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询