Oracle - 帮助进行查询
我有以下格式的数据源:
Event Type| Date
1 | 2011-07-14 09:00
1 | 2011-07-14 09:01
1 | 2011-07-14 09:02
2 | 2011-07-14 09:30
2 | 2011-07-14 09:31
1 | 2011-07-14 10:00
1 | 2011-07-14 10:01
事件类型按发生日期排序。我需要进行一个查询,该查询将显示使用事件时的日期范围,并按日期排序。像这样:
Event Type | Date Range
1 | 2011-07-14 09:00 - 2011-07-14 09:02
2 | 2011-07-14 09:30 - 2011-07-14 09:31
1 | 2011-07-14 10:00 - 2011-07-14 10:01
你有什么提示吗?我认为这可能需要通过分析函数来完成,但我还没有找到一个像样的解决方案。
I have source of data in the following format:
Event Type| Date
1 | 2011-07-14 09:00
1 | 2011-07-14 09:01
1 | 2011-07-14 09:02
2 | 2011-07-14 09:30
2 | 2011-07-14 09:31
1 | 2011-07-14 10:00
1 | 2011-07-14 10:01
Event types are sorted by date, as they occurred. I need to make a query which will show the date ranges when events were used, sorted by date. Like this:
Event Type | Date Range
1 | 2011-07-14 09:00 - 2011-07-14 09:02
2 | 2011-07-14 09:30 - 2011-07-14 09:31
1 | 2011-07-14 10:00 - 2011-07-14 10:01
Do you have any hints? I reckon this will probably need to be done with analytic functions, but I haven't been able to come up with a decent solution yet.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您还可以尝试以下方法:
You could also try the following approach:
我确信有更好的解决方案,但是这个呢?
这也应该能够应对“组”中只有一个事件的情况;如 (1, 1, 2, 1, 1)
I'm sure there is a better solution, but what about this?
This should also cope with scenarios where the 'group' only has one event in it; Such as (1, 1, 2, 1, 1)