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)