表数据示例:
查询区间:
2024-12-03 10:00:00 - 2024-12-06 18:00:00
mysql示例:
SELECT * FROM time_test WHERE ((start_time > '2024-12-03 10:00:00' AND ('2024-12-06 18:00:00' > end_time OR ( '2024-12-06 18:00:00' > start_time AND '2024-12-06 18:00:00' < end_time)))) OR (start_time < '2024-12-03 10:00:00' AND ( '2024-12-06 18:00:00' > end_time OR '2024-12-03 10:00:00' > start_time AND '2024-12-03 10:00:00' < end_time))
查询结果:
标签:03,00,12,06,time,2024,字段,时间,查询数据库 From: https://www.cnblogs.com/ccdr/p/18636341