sql将日期按照年月分组并统计数量
时间:2021-07-01 10:21:17
帮助过:7人阅读
SELECT DATE_FORMAT(releaseDate,"
%Y年
%m月")
AS dates,
COUNT(
*)
FROM t_diary
GROUP BY DATE_FORMAT(releaseDate,"
%Y年
%m月")
ORDER BY DATE_FORMAT(releaseDate,"
%Y年
%m月")
DESC ;
DATE_FORMAT();按照格式对某个日期操作
ORDER BY 排序
DESC 降序
sql将日期按照年月分组并统计数量
标签:esc orm style for from div 排序 sql rom