Mysql在select里使用if语句

sum() 、count() 类型的都可以使用

Posted on 2018-02-08 11:00:00 in Mysql   阅读(4409)

exp1等于true后会使用exp2,等于false会使用exp3
select count(if (exp1, exp2, exp3)) from xxx;