根据时间戳加入最后一条记录
我有一个访问日志,它记录应用程序中各个点的用户名和时间戳。我想看看我是否可以估算出他们在申请中花费的时间。基本上我想根据时间戳将每个记录连接到最后一个访问记录,这样我就可以计算出时间差。
我想不出如何加入时间戳小于当前记录的第一条记录。有什么方法可以做到这一点?
I have a access log, which records usernames and a timestamp at various points in the application. I want to see if I can approximate the amount of time they are spending in the application. Basically I want to join each record to the last access record based on the timestamp, so I can figure out the time difference.
I can't think of how to join to the first record whose timestamp is less than the current record. What is the way to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试这样的事情:
Try something like this:
您几乎给了自己答案:
类似于下面的内容应该有效:
当然,您应该添加更多内容:也许外连接的一个条件需要 userID 匹配...
You almost gave yourself the answer:
Something similar to below should work:
Of course, you should add some more to this: maybe a condition to the outer join that requires the userID match...