Mysql 查询 多条件判断

条件:
1、>=90:优秀
2、>=80:良好
3、>=60:及格
4、<60:不及格

执行:
select id as 学号, name as 姓名, score as 分数,   
(  
  case  
    when score >= 90 then '优秀' 
    when score >= 80 and score < 90 then '良好' 
    when score >= 60 and score < 80 then '及格' 
    when score < 60 then '不及格' 
  end 
)  
as 等级  
from scores;

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容