SQL中CASE的用法
2014-09-24 14:02
288 查看
创建一张测试表
显示结果:
<span style="font-size:18px;">create table test9009 ( id int identity(1,1) primary key, score int ) insert into test9009 values(500) insert into test9009 values(200) insert into test9009 values(1000) insert into test9009 values(1500) insert into test9009 values(300) insert into test9009 values(2000) insert into test9009 values(1520) insert into test9009 values(3000) insert into test9009 values(35000)</span>
<span style="font-size:18px;">select *, case when score<500 then '列兵' when score>=500 and score<=1500 then '上等兵' else '上士' end as 等级 from test9009</span>
显示结果:
相关文章推荐
- 一个SQL语句的用法。Case 用法
- sql中CASE的用法
- SQL中的Case用法:基础
- 教你轻松掌握SQL Server中Case的不同用法
- SQL中 case when then end的用法
- sql中CASE的用法
- SQL中Case的用法(转载学习)
- sql中case的用法
- SQL中CASE的用法
- SQL:select case when的一些用法
- SQL中case的用法(转)
- SQL里面Case的用法
- SQL语句中 CASE 的用法
- sql中CASE的用法
- SQL case用法
- sql中CASE的用法
- sql语句中"case when"的简单用法示例
- 【Vegas原创】SQL case when 用法
- sql中CASE的用法
- 教你轻松掌握SQL Server中Case的不同用法