SELECT MONTHNAME(date_added) as month,
(SELECT COUNT(*) FROM requests WHERE form_status = :approved) AS approved,
(SELECT COUNT(*) FROM requests WHERE form_status = :denied) AS denied,
(SELECT COUNT(*) FROM requests WHERE form_status = :completed) AS completed,
(SELECT COUNT(*) FROM requests WHERE form_status = :pending) AS pending
FROM requests WHERE req_dept = :req_dept GROUP BY month
结果不是我所期望的。我想统计表单状态,并最终按月分组,但结果是每个月的计数都是一样的。我使用chartjs。
1条答案
按热度按时间62lalag41#
让我们试试这个:-