mysql 根据date做年,月,日分组统计查询
使用 YEAR(), MONTH(), DAY() 来获取年月日
SELECT YEAR(application_date) as years, count(1) FROM patent GROUP BY YEAR(application_date) ORDER BY years -- YEAR(application_date) 获取年份-- MONTH(application_date) 获取月份-- DAY(application_date) 获取日 使用 date_format(application_date, ‘%Y‘),可自定义日期格式 SELECT date_format(application_date, "%Y") as year, count(1) FROM patent GROUP BY date_format(application_date, "%Y")
相关推荐
九天银河技术 2020-11-11
tufeiax 2020-09-03
zhangjie 2020-11-11
Crazyshark 2020-11-13
步知道 2020-10-27
李轮清 2020-09-15
85251846 2020-09-14
wangpaiyonghu 2020-06-28
jackalwb 2020-06-14
yhljxy 2020-06-14
myveer 2020-06-14
xiaobaif 2020-06-14
klarclm 2020-06-13
songshijiazuaa 2020-06-13
TMD咯MySQL 2020-06-12
archive 2020-06-12
清风徐来水波不兴 2020-06-09