SELECT COUNT(1), COUNT(IF(state = 1, true, null)), COUNT(IF(state = 0, true, null))
 FROM fms_device