cbys.net
当前位置:首页 >> mysql thEn >>

mysql thEn

不知你用的是什么查询分析器。 我记得 select count(*) into @cnt from table1 where map_id = 114 and `type` = 400 ; if @cnt > 0 then update table1 set `count` = 25 where map_id = 114 and `type` = 400; else insert table1 (map_id,`co...

设置 mysql配置文件/etc/my.cnf中加入character-set-server=utf8 启动mysql服务: service mysqld start或者/etc/init.d/mysqld start 开机启动: 添加开机启动:chkconfig --add mysqld; 开机启动:chkconfig mysqld on;

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

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

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

--在5.1.55中运行没问题--另外没有show version,只有select version();--你拷贝下面的代码试试?create procedure `test2`(IN cusername VARCHAR(50),IN cpassword VARCHAR(50),IN clastloginio VARCHAR(50))BEGINif exists(select * from mt_u...

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...

mysql 的sql语句如下: mysql> delimiter // -> create trigger sitedata_ins2 -> before insert on user -> for each row -> Begin -> If not exists(select 1 from user_data where d_id=new.id) then -> insert into user_data(d_id,d_name) v...

用一个SQL好像实现不了,还是用存储过程吧。 或者用多次SQL语句

mysql> DELIMITER // mysql> CREATE PROCEDURE TestIfElse -> ( -> p_val INT -> ) -> BEGIN -> IF (p_val = 1) THEN -> SELECT '1' AS A; -> ELSEIF (p_val = 2) THEN -> SELECT '2' AS A; -> ELSE -> SELECT 'other' AS A; -> END IF; -> END/...

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