jcgj.net
当前位置:首页 >> mysql CAsE whEn thEn >>

mysql CAsE whEn thEn

可以的吧,出NULL是不是因为你字段的内容就是NULL埃 这里是一个测试,可以看到使用列名value来做then的值是可以的: mysql> select * from aaa;+------+-------+| id | value |+------+-------+| 1 | 1 || 2 | 3 || 3 | 4 || 4 | 4 || 5 | 4 || ...

直接加在语句最后就行了。 UPDATE `member` SET score = (CASE WHEN score IS NOT NULL THEN score = 0 ELSE score = 1 END) where id =1; mysql数据库中CASE WHEN语句。 case when语句,用于计算条件列表并返回多个可能结果表达式之一。 CASE ...

举例说明 SELECT CASE a.AFTER_QUALITY WHEN '0' THEN '过免维期' WHEN '1' THEN '未过免维期' ELSE '错误数据' END AS AFTER_QUALITY FROM t_maintain_log a 数据库表内容:

(1)数字 如果 Measures.CurrentMember 是空单元,则下面的示例返回 0,否则返回 1 IIf(IsEmpty(Measures.CurrentMember), 0, 1) (2)字符串 如果Measures.CurrentMember 是空单元,则下面的字符串返回字符串"Yes",否则返回字符串"No" IIf(IsEmpt...

试试这个,没有测试: select date, sum(if(a = 1, 1, 0)) as A1, sum(if(a = 2, 1, 0)) as A2from tab where a=1group by date

给你个例子 SELECT RQ,CASE DEPTID WHEN '0201' THEN '开发区店' WHEN '0202' THEN '金州店' WHEN '0203' THEN '华南南店' END FD FROM GHDWJXCR GROUP BY RQ,SUBSTRING(DEPTID,1,4)

select case when diff_flg=0 then jet_nm+'哈哈哈' else diff_flg END from je_test where je_id = 1

select case when vipStartDate is null then '9999999999' else vipStartDate end as vipStartDate from 表

去这个地方看看就明白了: http://zhidao.baidu.com/question/336737352.html 我已经回答过了。

oracle也有case when的语法,照办就行,不过用在where条件中,需要有返回值的比较. 这是根据你提供的语句修改,给你提供一个参考吧: where a.xxx = 'asdf' and ( case when (b.i like '%0%') then true when (b.i like '%1%') and c.creatorCod...

网站首页 | 网站地图
All rights reserved Powered by www.jcgj.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com