class_t(classid,classname)
g1 一班
g2 二班
g3 三班
... ...
student_t(studentid,studentname,classid)
101 张三 g1
102 李四 g2
103 王武 g3
... ... ...
course_t(courseid,coursename)
s1 数学
s2 英语
s3 化学
... ...
score_t(studentid,courseid,score)
101 s1 80
101 s2 70
101 s3 90
101 ... .. 6、若对成绩进行等级划分,90以上为优,80-90为良,60-80为及格,60以下为不及格;
6.1、将成绩表按等级显示出来
select a.classname,b.studentname,成绩情况=
case c.score
when 'c.score>90' then '优'
when 'c.score>=80 and c.score<=90' then '良'
when 'c.score>=60 and c.score<=80' then '及格'
when 'c.score<60' then '不及格'
end
from class_t A,student_t B,score_t C
where a.classid=b.classid and b.studentid=c.studentid错误提示:服务器: 消息 245,级别 16,状态 1,行 1
将 varchar 值 'c.score>90' 转换为数据类型为 int 的列时发生语法错误。请问这个问题怎么解决呢?
g1 一班
g2 二班
g3 三班
... ...
student_t(studentid,studentname,classid)
101 张三 g1
102 李四 g2
103 王武 g3
... ... ...
course_t(courseid,coursename)
s1 数学
s2 英语
s3 化学
... ...
score_t(studentid,courseid,score)
101 s1 80
101 s2 70
101 s3 90
101 ... .. 6、若对成绩进行等级划分,90以上为优,80-90为良,60-80为及格,60以下为不及格;
6.1、将成绩表按等级显示出来
select a.classname,b.studentname,成绩情况=
case c.score
when 'c.score>90' then '优'
when 'c.score>=80 and c.score<=90' then '良'
when 'c.score>=60 and c.score<=80' then '及格'
when 'c.score<60' then '不及格'
end
from class_t A,student_t B,score_t C
where a.classid=b.classid and b.studentid=c.studentid错误提示:服务器: 消息 245,级别 16,状态 1,行 1
将 varchar 值 'c.score>90' 转换为数据类型为 int 的列时发生语法错误。请问这个问题怎么解决呢?
解决方案 »
- 怎么批量导出SQL2005里面的存储过程生成SQL脚本
- 批量修改sql默认值的问题?
- 一个sql语句的问题
- 服务Task Scheduler会不会影响到sql2008数据库的定时备份
- 数据库复制技术,那位高手帮忙看看。。。
- SQL SERVER中如何完成定时任务?
- 储存过程的问题
- 如何取出这些数据?
- 有一个商品资料表,数据库中的很多表都引用约束这个商品资料的条码资料,然后当数据库很大时,我想删除某一条码资料时系统会很慢很慢
- 我要将MS SQLSERVER2000的服务器->属性->连接->并发设置为1的话,能不能禁止并发的可能,如果两台客户端出现了并发,会出现什么情况
- 有权限备份恢复SqlServer2005,如何取得备份的数据库文件?
- 复杂的查询语句
case c.score
when 'c.score>90' then '优'
when 'c.score>=80 and c.score<=90' then '良'
when 'c.score>=60 and c.score<=80' then '及格'
when 'c.score<60' then '不及格'
end case
from class_t A,student_t B,score_t C
where a.classid=b.classid and b.studentid=c.studentid
case
when c.score>90 then '优'
when c.score>=80 and c.score<=90 then '良'
when c.score>=60 and c.score<=80 then '及格'
when c.score<60 then '不及格'
end
from class_t A,student_t B,score_t C
where a.classid=b.classid and b.studentid=c.studentid
select a.classname,b.studentname,成绩情况=
case c.score
when c.score>90 then '优'
when c.score>=80 and c.score<=90 then '良'
when c.score>=60 and c.score<=80 then '及格'
when c.score<60 then '不及格'
end
from class_t A,student_t B,score_t C
where a.classid=b.classid and b.studentid=c.studentid
case c.score
when c.score>90 then '优'
when c.score>=80 and c.score<=90 then '良'
when c.score>=60 and c.score<=80 then '及格'
when c.score<60 then '不及格'
end
from class_t A,student_t B,score_t C
where a.classid=b.classid and b.studentid=c.studentid