方法一 加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