赞
踩
对不同状态的设备进行统计
SELECT count(1) AS total,
sum(CASE WHEN handle_state = 1 THEN 1 ELSE 0 END) AS handleNum,
sum(CASE WHEN handle_state = 2 THEN 1 ELSE 0 END) AS noticeNum,
sum(CASE WHEN handle_state = 3 THEN 1 ELSE 0 END) AS developNum,
sum(CASE WHEN handle_state = 4 THEN 1 ELSE 0 END) AS archiveNum
FROM fire_handle
WHERE to_days(alarm_time) = to_days(
now())
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。