LMSouq
database Open

MySQL Query GROUP BY day / month / year

FE
Fernando Barrocal
1 month ago
3 views
Problem Description
Is it possible to make a simple query to count how many records I have in a determined period of time like a year, month, or day, having a `TIMESTAMP` field, like: SELECT COUNT(id) FROM stats WHERE record_date.YEAR = 2009 GROUP BY record_date.YEAR Or even: SELECT COUNT(id) FROM stats GROUP BY record_date.YEAR, record_date.MONTH To have a monthly statistic.

AI-Generated Solution

Powered by LMSouq AI · GPT-4.1-mini

✓ Solution Ready
Analyzing problem and generating solution…
Was this solution helpful?
Back to Knowledge Base