使用 YEAR(), MONTH(), DAY() 來獲取年月日 SELECT YEAR(application_date) as years, count(1) FROM patent GROUP BY YEAR(application_date) ORDER BY years -- YEAR(a ...
-
使用 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")