Get mySQL rows in minute-by-minute time range over multiple hours

MySQL minute function is literally taking the minute number and grouping by that. Try grouping by hour then minute:

GROUP BY HOUR(date), MINUTE(date)

New answer for old question!

To group by minute, you can simply:

SELECT (unix_timestamp(`date`) - unix_timestamp(`date`)%60) groupTime, count(*) 
FROM yourTable
# WHERE clause
GROUP BY groupTime

With this solution, you will never mixed datetimes of a minute with datetimes of the same minute of another hour, day, ...

Plus, It's an evolutive solution because, by changing "60" to another number, you can group by a couple of minutes (120), by a day (86400), ...


Just use DATE_FORMAT:

GROUP BY DATE_FORMAT(`date`, '%H:%i')