count计数里添加条件
2023-06-25 本文已影响0人
新苡米
方法一 加or null
count(cast (duration as int)>180 or NULL) as overdue
方法二 加if判断
select count(if( t.command_name = 'UNLOCK' ,1,null)) from t
count(cast (duration as int)>180 or NULL) as overdue
select count(if( t.command_name = 'UNLOCK' ,1,null)) from t