본문 바로가기
SW 프로그래밍/Mariadb

날짜별로 행의 집계값 얻기

by N2info 2020. 9. 26.
SELECT DATE_FORMAT(column, ‘%Y%m%d’) as date, count(*)
FROM table
GROUP BY DATE_FORMAT(column, ‘%Y%m%d’)
ORDER BY date ASC;

 

SELECT DATE_FORMAT(rdate, '%Y%m%d') as date, count(*)
FROM `cc_3f_test`
GROUP BY DATE_FORMAT(rdate, '%Y%m%d')
ORDER BY date ASC;