IFNULL

来源:互联网 发布:mac打印机设置 编辑:程序博客网 时间:2024/06/03 18:36
MYSQL IFNULL(expr1,expr2)
如果expr1不是NULL,IFNULL()返回expr1,否则它返回expr2。IFNULL()返回一个数字或字符串值,取决于它被使用的上下文环境。          mysql> select IFNULL(1,0);                           -> 1      mysql> select IFNULL(0,10);                           -> 0      mysql> select IFNULL(1/0,10);                           -> 10      mysql> select IFNULL(1/0,yes);                           -> yes    

0 0