http://www.cnblogs.com/eshizhan/archive/2012/04/06/2435493.html
1. case when表达式的两种形式:
--简单Case函数
CASE sex
WHEN '1' THEN '男'
WHEN '2' THEN '女'
ELSE '其他' END
--Case搜索函数
CASE
WHEN sex ...
分类:
数据库 时间:
2015-05-04 15:33:01
阅读次数:
116
SELECT
t1.id,
t1.channel_id,
t1.sum_amount,
t1.sum_date,
t1.msisdn_num,
t2.num,
t2.id?AS?channel_complaint_id,
??case?
????when?t2.num?is?not?null?then?t2.num/(t1.msisdn_num*1...
分类:
数据库 时间:
2015-05-04 12:07:50
阅读次数:
229
原表学生 学科 分数 语文 数学 外语修改后学生 语文 数学 外语 分数 分数 分数select *from StudentClassselect studentname,sum(case when subject='语文'then sc...
分类:
数据库 时间:
2015-05-04 11:46:37
阅读次数:
143
sha1(); 40位sha(); 40位md5(); 32位password(); 41位case when then end 的用法select sname 姓名,sscore 成绩,case when sscore is null then '补考'when sscore>=90 then '...
分类:
数据库 时间:
2015-05-04 06:22:58
阅读次数:
134
1、case 函数:--简单Case函数CASE sexWHEN '1' THEN '男'WHEN '2' THEN '女'ELSE '其他' END--Case搜索函数CASE WHEN sex = '1' THEN '男'WHEN sex = '2' THEN '女'ELSE '其他' END备...
分类:
数据库 时间:
2015-05-03 14:33:02
阅读次数:
131
select sum(case when (t.条件字段='00') then 1 else 0 end)"描述名称1", sum(case when (t.条件字段='01') then 1 else 0 end)"描述名称2" from 表名 t...
分类:
数据库 时间:
2015-05-02 06:18:28
阅读次数:
139
CASE命令有两种语句格式。语法形式1:CASE expressionWHEN expression_11 THEN expression_12…WHEN expression_n1 THEN expression_n2[ELSE expression_m]END该语句的执行过程是:将CASE后面表...
分类:
其他好文 时间:
2015-05-01 11:55:42
阅读次数:
116
有这样一道面试题:一张表数据如下 1900-1-1 胜 1900-1-1 胜 1900-1-1 负 1900-1-2 胜 1900-1-2 胜 写出一条SQL语句,使检索结果如下: 胜 负 1900-1-1 2 1 1900-1-2 2 0我随手建了这样一个表:create table test(D...
分类:
数据库 时间:
2015-04-27 09:30:36
阅读次数:
217
SQL中Case When语句的语法如下Simple CASE expression: CASE input_expression WHEN when_expression THEN result_expression [ ...n ] [ ELSE else_result_ex...
分类:
其他好文 时间:
2015-04-25 19:49:06
阅读次数:
170
运算符优先级顺序最高优先级 :=1 ||, or, xor2 &&, and3 between, case, when, then, else4 =, , >=, >, , !=, is, like, regexp, in5 |6 &7 >8 -, +9 *, /, div, %, mod10 ^1...
分类:
数据库 时间:
2015-04-23 17:07:05
阅读次数:
1613