我有这样的记录表预订:
id | from | to
------+---------------------+---------------------
101 | 2015-09-24 08:00:00 | 2015-09-24 09:30:00
2261 | 2015-09-24 09:00:00 | 2015-09-24 10:00:00
4061 | 2015-09-24 10:00:00 | 2015-09-24 10:30:00
204 | 2015-09-24 12:00:00 | 2015-09-24 13:30:00
2400 | 2015-09-24 13:30:00 | 2015-09-24 14:00:00
4224 | 2015-09-24 14:00:00 | 2015-09-24 14:30:00
309 | 2015-09-24 16:00:00 | 2015-09-24 17:30:00
2541 | 2015-09-24 17:00:00 | 2015-09-24 18:00:00
我正在寻找最佳查询来找到问题的答案:
Is this possible to find a timeslot with duration x (ie. 30 minutes) in above records?
我有使用 postgres 数组或时间范围的想法,但仍在寻找更好的想法......
编辑:我将提供“假”预订作为界限,但如果您有更好的方法,请写信:)