隐患数据统计分析:本月上报隐患排名,隐患数量不正确修复

main
15036302109 8 months ago
parent 6e0e417c08
commit dae090e4e5

@ -155,12 +155,19 @@ SELECT
(
SELECT
d.dept_name 'areaName',
count(r.dept_id) 'reportHiddenNum'
IFNULL(SUM( hd_count ),0) 'reportHiddenNum'
FROM
sys_dept d left join (select * from ehs_hidden_danger where
DATE_FORMAT(NOW(), '%Y-%m') = DATE_FORMAT( check_time, '%Y-%m')) r on r.dept_id = d.dept_id
sys_dept d
LEFT JOIN (
SELECT
*
FROM
ehs_hidden_danger
WHERE
DATE_FORMAT( NOW(), '%Y-%m' ) = DATE_FORMAT( check_time, '%Y-%m' )) r ON r.dept_id = d.dept_id
GROUP BY
d.dept_id,d.dept_name
d.dept_id,
d.dept_name
) s
ORDER BY
s.reportHiddenNum DESC

Loading…
Cancel
Save