数据库查询,按年月排序,计算每月有几条数据
数据库查询,按年月排序,计算当年每月有几条数据
SELECT DATE_FORMAT(inspection_date,'%Y-%m') AS DATETIME, count(*) AS num FROM gw_inspection_data t1 WHERE YEAR(inspection_date) = YEAR(CURDATE()) GROUP BY DATE_FORMAT(inspection_date,'%Y-%m')
标签:每月,数据库,按年,date,排序,inspection From: https://www.cnblogs.com/y593216/p/17936286.html