sqlite |计算表中的时间戳差
我有一个桌子&尝试计算行之间的时间差:
例如:
Time difference for (rowid: 4) = time (rowid: 3) - time (rowid: 4) = 429168
,其余部分相同。
我该怎么做? 谢谢。
I have a table & trying to calculate time differences between the rows:
For example:
Time difference for (rowid: 4) = time (rowid: 3) - time (rowid: 4) = 429168
And same for the rest.
How could I do that?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于每一行,您可以使用
lag()
窗口函数来获取上一行的时间:或:
在哪里替换
?
用time
在没有以前的行时获得。SQL语句应为:
For each row you can get the previous row's time with
LAG()
window function:or:
where you replace
?
with thetime
that you want to get when there is no previous row.The sql statement should be: