时间:2021-07-01 10:21:17 帮助过:30人阅读
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")
mysql 根据date做年,月,日分组统计查询
标签:使用 mys cat ring mat 日期格 ati ima mysql