早教吧作业答案频道 -->其他-->
一张成绩表,学生编号,课程,成绩课程有五门:英语,我想查询后这样展示.张三4045454545请教SQL如何写selects.stuname,c1.totalscore,c2.totalscore,c3.totalscore,c4.totalscore,c5.totalscorefromstudentsfulljoin((((
题目详情
一张成绩表,学生编号,课程,成绩 课程有五门:英语,
我想查询后这样展示.
张三 40 45 45 45 45
请教SQL如何写
select
s.stuname,c1.totalscore,c2.totalscore,c3.totalscore,
c4.totalscore,c5.totalscore
from
student s full join
((((
chengji c1 left join chengji c2
on c1.topless=0 and c2.topless=1 and c1.stuid=c2.stuid)
left join chengji c3
on c3.topless=2 and c1.stuid=c3.stuid)
left join chengji c4
on c4.topless=3 and c1.stuid=c4.stuid)
left join chengji c5
on c5.topless=4 and c1.stuid=c5.stuid)
on s.stuid=c1.stuid where s.stuid=102
这是我的sql 语句 但是总是有错误 .
没有分数时,仍能查询出值.
我想查询后这样展示.
张三 40 45 45 45 45
请教SQL如何写
select
s.stuname,c1.totalscore,c2.totalscore,c3.totalscore,
c4.totalscore,c5.totalscore
from
student s full join
((((
chengji c1 left join chengji c2
on c1.topless=0 and c2.topless=1 and c1.stuid=c2.stuid)
left join chengji c3
on c3.topless=2 and c1.stuid=c3.stuid)
left join chengji c4
on c4.topless=3 and c1.stuid=c4.stuid)
left join chengji c5
on c5.topless=4 and c1.stuid=c5.stuid)
on s.stuid=c1.stuid where s.stuid=102
这是我的sql 语句 但是总是有错误 .
没有分数时,仍能查询出值.
▼优质解答
答案和解析
select s.name,sum(case topless when 0 then totalscore else 0 end)数学,sum(case topless when 1 then totalscore else 0 end)语文,sum(case topless when 2 then totalscore else 0 end)英语,sum(case topless w...
看了一张成绩表,学生编号,课程,成...的网友还看了以下:
一道小学工程应用题一个工程甲单独做2天后乙再单独做5天共完成工程的4/15,如果甲单独做5天后乙再 2020-04-26 …
谁能详细的跟我说明一下《摩托车2冲程和4冲程有什么区别》 400CC排量1000最高时速是多少?. 2020-05-13 …
一项工程,有甲乙合作12天完成.现在有甲乙合作4天后,余下的工程先由甲独做10天后,再由乙独做5天 2020-06-19 …
记方程①:x2+a1x+1=0,方程②:x2+a2x+2=0,方程③:x2+a3x+4=0,其中a 2020-07-30 …
一项工程,有甲乙两个工程合做,6天就可以完成;由甲先做4天,余下的乙再做10天也可以完成.这项工程 2020-07-30 …
高一恒成立,有解问题(1)方程x²-4x+3b=0在[1,4]有解,b取值范围?(2)不等式x²- 2020-07-31 …
用列举法表示下列各集合1.所有小于5的正整数组成的集合2.绝对值小于4的所有整数组成的集合3.方程 2020-08-01 …
一项工程,甲乙两人合作8天完成.由甲先做了4天,乙接着做了12天,刚好完成工程的5/6.剩下的工程有 2020-11-04 …
跟工程有关一项工程要限期完成,如果第一组单独做恰好按规定日期完成,如果第二组单独做需要超过规定日期4 2020-11-05 …
某分工程有3个施工过程,各分有4个流水节拍相同的施工段,各施工过程的流水节拍分别为6天,6天,4天. 2020-11-06 …