You can use stored procedures to solve this problem. If there is a timestamp field timestamp in your table and you need data every half hour in August and September, you can create a stored procedure as follows
delimiter $$
CREATE PROCEDURE test()
begin
declare begintime int(10);
set begintime = unix_timestamp("2016-7-31 23:59:59");
loop1:LOOP
IF begintime > unix_timestamp("2016-9-30 23:59:59") then
leave loop1;
END IF;
select * from tablename where timestamp between begintime and begintime+1800;
set begintime = begintime + 1800;
END LOOP loop1;
end;$$
The basic meaning is to select half an hour of data each time. Then add half an hour to each cycle time. The stored procedure has not been strictly tested, but you can refer to it for ideas. . .
You can use stored procedures to solve this problem. If there is a timestamp field timestamp in your table and you need data every half hour in August and September, you can create a stored procedure as follows
The basic meaning is to select half an hour of data each time. Then add half an hour to each cycle time.
The stored procedure has not been strictly tested, but you can refer to it for ideas. . .
Why not write a sql and then execute it every half an hour to read the data in the previous half hour?