mysql根据date做年,月,日分组统计查询
使用 YEAR(), MONTH(), DAY() 来获取年月日
SELECTYEAR(application_date) as years, count(1) FROM patent GROUPBYYEAR(application_date) ORDERBY years
-- YEAR(application_date) 获取年份
-- MONTH(application_date) 获取月份
-- DAY(application_date) 获取日
- 使用
date_format(application_date
,
"%Y"
),可自定义日期格式
SELECT date_format(application_date, "%Y") asyear, count(1) FROM patent GROUPBY date_format(application_date, "%Y")
以上是 mysql根据date做年,月,日分组统计查询 的全部内容, 来源链接: utcz.com/z/533653.html