MySQL count and group by day

mysql, sql

Solution

You can group using the DAY function:

SELECT DAY(Date), COUNT(*)
FROM table
WHERE TID = 8882
GROUP BY DAY(Date)

Problem

I have the following structure ``` ID DATE(DATETIME) TID 1 2012-04-01 23:23:23 8882 ``` I'm trying to count the amount of rows and group them by each day of the month that matches TID = 8882 Thanks

Original source

Related problems