Home > Database > Mysql Tutorial > MySQL实现类似Oracle中的decode()函数的功能

MySQL实现类似Oracle中的decode()函数的功能

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-07 16:56:47
Original
3580 people have browsed it

mysqlgt; select if(1=1,10,20);+---------------+| if(1=1,10,20) |+---------------+| 10 |+---------------+1 ro

mysql> select if(1=1,10,20);
+---------------+
| if(1=1,10,20) |
+---------------+
|            10 |
+---------------+
1 row in set (0.00 sec)

上面的代码就是mysql里面的,实现的功能和Oracle的decode()函数一样,例如:

 select decode(字段名,,表达式1,值1,表达式2,值2) from dual;

linux

Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
MySQL stops process
From 1970-01-01 08:00:00
0
0
0
Error when installing mysql on linux
From 1970-01-01 08:00:00
0
0
0
phpstudy cannot start mysql?
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template