将行分组不到一分钟,将行与Oracle的前排分开
我有一个带有时间戳记的Oracle表,我需要检查当前行更大的所有行,上一行少于一分钟,并说明开始时间和结束时间,如果它大于一分钟,我需要启动一个如下示例中的新组。 (该表是在ASC时间下排序的,
我有表
ID | 时间(时间戳记) |
---|---|
11:33:03 | |
11:34:01 | |
11:34:40 | |
11:35:59 | |
11:38:00 | |
11:38:50 |
我需要拉
小组编号 | 开始时间 | 结束时间 |
---|---|---|
1 | 11:33:03 | 11:34: 40 |
2 | 11:35:59 | 11:35:59 |
3 | 11:38:00 | 11:38:50 |
I have an Oracle table with time stamps and I need to check on all rows where the current row is bigger the the previous row by less than a minute and state the start and end time and if its bigger than a minute I need to start a new group as in the example below. (The table is ordered in ASC time
I have the table
ID | TIME (TIME STAMP) |
---|---|
11:33:03 | |
11:34:01 | |
11:34:40 | |
11:35:59 | |
11:38:00 | |
11:38:50 |
I need to pull
Group number | start time | end time |
---|---|---|
1 | 11:33:03 | 11:34:40 |
2 | 11:35:59 | 11:35:59 |
3 | 11:38:00 | 11:38:50 |
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用:
示例数据:
输出:
db<>>> fiddle 在这里
You can use:
Which, for the sample data:
Outputs:
db<>fiddle here