sql语句中如何用case when 语句当满足条件时输出,否则不输出。分值不...
发布网友
发布时间:2024-04-01 23:39
我来回答
共2个回答
热心网友
时间:2024-04-07 06:07
select case when 1>0 then 2 else 3 end ;
显然1>0为真,则输出结果为then后面的数据2
热心网友
时间:2024-04-07 06:04
select * from dbo.score
select UID,成绩=case
when ExamScore<60 then 'E'
when ExamScore between 60 and 69 then 'D'
when ExamScore between 70 and 79 then 'C'
when ExamScore between 80 and 89 then 'B'
else 'A'
end
from dbo.score
和这个类似 适当修改即可