转帖 mysql里面的oracle decode
来源:互联网 发布:sql端口1433 编辑:程序博客网 时间:2024/05/16 10:27
oracle里面有一个decode的函数,顾名思义,可以将1,2,3按照需求转成a,b,c,最后还有一个缺省
值。
mysql里面好像没有这个函数。但是可以用另外的函数来实现类似的效果。
IF(expr1,expr2,expr3)
如果expr1是TRUE(expr1<>;0且expr1<>;NULL),那么IF()返回expr2,否则它返回expr3。IF()返回
一个数字或字符串值
oracle的写法
SELECT decode(ttype,1,’a',2,’b',3,’c',’d') FROM taba
可以在mysql里写成
SELECT if( ttype =1, ‘a’, if( ttype =2, ‘b’, if( ttype =3, ‘c’, ‘d’ ) ) )
FROM taba
- 转帖 mysql里面的oracle decode
- mysql类似于oracle的decode的一种用法
- mysql 如何实现oracle中decode(...)函数的功能
- mysql中case-when-then和oracle的decode函数
- oracle的decode
- Oracle DECODE 的用法
- Oracle的DECODE函数
- Oracle的DECODE()使用
- oracle 的 decode函数
- Oracle Decode()的使用
- Oracle decode的用法
- oracle 的decode 函数
- Oracle的decode函数
- Oracle的decode函数
- python里面的encode和decode
- 在MYsql中实现oracle中的DECODE
- MYSQL实现ORACLE中的decode()函数
- oracle decode函数的用法
- 在ipv6下使用veno可以直接访问ipv4
- JavaScript内置对象
- LAMP兄弟连在线讲堂 -- 面向对象的程序设计(上)
- 删除表中的重复记录只保留其中一条
- 转mysql CASE WHEN的基础和多种用法
- 转帖 mysql里面的oracle decode
- PIC学习 SPI模块部分
- 第一记
- windows7现在可以兼容VC6.0了
- 求解?!!!!
- KOBE BYRANT
- 计算机专业
- 从计算机复试看中国教育——一个面试官的经历
- 在hibernate中保存从对象