假设我们有这样的表设置:
+---------+--------------+---------------+
| id text | time integer | value decimal |
+---------+--------------+---------------+
| 1 | 1 | 10 |
| 1 | 2 | 10 |
| 1 | 3 | 7 |
| 1 | 4 | 8 |
| 1 | 5 | 6 |
| 1 | 6 | 5 |
| 1 | 7 | 4 |
| 1 | 8 | 3 |
| 1 | 9 | 7 |
| 1 | 10 | 11 |
| 1 | 11 | 3 |
| 1 | 12 | 8 |
| 1 | 13 | 2 |
| 1 | 14 | 4 |
| 1 | 15 | 1 |
+---------+--------------+---------------+
是否可以在id
一定时间内选择相同条件下的开始时间和结束时间?假设我们想查看1
值所在的ID< 10
至少几秒钟。所以结果查询将返回:
+------------+----------+
| start_time | end_time |
+------------+----------+
| 11 | 15 |
| 3 | 9 |
+------------+----------+