Sql queries data from multiple time segments

now there are two tables

A duration table for storing time fragments

CREATE TABLE `duration`  (
  `id` int(0) NOT NULL,
  `start_time` datetime(0) NULL,
  `end_time` datetime(0) NULL,
);

A data table for storing data, with the insertion time of the data

CREATE TABLE `data`  (
  `id` int(0) NOT NULL,
  `record_time` datetime(0) NULL,
);

these two tables id are repeatable
now multiple pieces of data are found from the duration table, that is, multiple time fragments are obtained, and then the data between the multiple time fragments previously identified by the corresponding record_time is found in the data table.
what do you guys do with this?

Sep.03,2021

insert into duration (id, start_time, end_time) 
values(1, '2018-1-1', '2018-1-10'),
(2, '2018-2-1', '2018-2-10'),
(3, '2018-3-1', '2018-3-10');


insert into data (id, record_time)
values(1, '2018-1-2'),
(2, '2018-2-2'),
(3, '2018-3-2'),
(4, '2018-4-2'),
(5, '2018-1-12');


select data.* from data, duration where record_time between start_time and end_time ;

the result will be:

'1', '2018-01-02 00:00:00'
'2', '2018-02-02 00:00:00'
'3', '2018-03-02 00:00:00'
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-1b46247-2c039.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-1b46247-2c039.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?