Mysql queries, for example, one in 25 minutes by time interval.

problem description

there is a sensor that inputs data once in 5 seconds. The sensor table has a createTime field
data is too much to extract by time. Users can customize the event interval,-sharp {time} can be passed

the environmental background of the problems and what methods you have tried

because we usually take historical data for 30 days, I try to use the method of
select ID, ALARMID, SENSORID, ALARMNAME, ROOMNAME, SENSORMODEL, SENSORNUM, REMARK,

.
CREATETIME,VALUE,MINUTE(CREATETIME) a
from fire_alarm_history
where SENSORID = -sharp{sensorId,jdbcType=VARCHAR}
and MINUTE(CREATETIME)% -sharp{time,jdbcType=INTEGER} =0 
group by a
order by CREATETIME desc

but it can only be a common divisor of 60, for example, not in 11 minutes. It can only go to 0 11 22 33 44 55 minutes

.

related codes

/ / Please paste the code text below (do not replace the code with pictures)

what result do you expect? What is the error message actually seen?

Mar.11,2022
The idea of

is OK. UNIX_TIMESTAMP (date) takes the remainder in seconds, but it may have to be a range rather than an integer.

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-1e5f43a-45835.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-1e5f43a-45835.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?