Grouping MySQL query by date

Working on a statistics plugin I needed a way to group records by the day.  Turns out it's remarkably easy.
PLAIN TEXT
SQL:

SELECT COUNT(id), theDate FROM TABLE GROUP BY YEAR(theDate), MONTH(theDate), DAY(theDate);

If you just want to group by year and month take off the DAY() part.  This would also be a good query to use WEEK() [...]