MySQL实现类似Oracle中的decode()函数的功能
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;
相关推荐
bianxq 2020-05-16
LuoXinLoves 2020-03-26
Streamoutput 2020-05-01
Streamoutput 2020-04-30
zhangxiaojiakele 2019-12-21
Nicolase 2019-12-19
us0 2019-09-05
yanghuatong 2013-05-04
不懂 2019-07-07
qiguiting 2019-07-01
CoreyJia 2015-05-29
handle0 2011-03-18
linkincsdn 2013-07-04
87497718 2012-04-18
89367267 2011-09-17
lester 2018-08-31
katnisswuyuechen 2018-12-21