Mysql, questions about group, how to group by time period

now there is a usage time field, how to use group to group time periods, the grouping method is 0-10 minutes, 10-20 minutes 20-30 minutes, ask for advice.

Jun.18,2021

Statistics by minute count , such as 2018-08-26 10:20:00 to 2018-08-26 10:29:59 through substr function 2018-08-26 10:2 , then group by .

for example, there is now a table with id int primary key and time datetime field. Then the statistical SQL is
SELECT count (id), SUBSTR (time,1,15) dt from table GROUP BY dt

.

what format is the usage time field?
datetime time point? Or int minutes?


refer to Mysql group query by time period to count the number of members

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ed0b01-32f6.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ed0b01-32f6.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?