sql query statistics data for the current month daily

SELECT
    count(a.id) AS '数量',
    DAY (a.create_date) AS '时间'
FROM
    test aWHERE
    MONTH (a.create_date) = MONTH (NOW()) 
GROUP BY
    DAY (a.create_date)

MONTH DAY function and the function is mainly used, GOOUP BY grouping query if the query data statistics every day last month

MONTH (NOW ()) -1 to

Guess you like

Origin www.cnblogs.com/cyc-ghost/p/11993282.html