您可以使用窗口函数(又名“分析函数”)访问“当前”行之外的行中的值。
如果这样做,则必须指定一个标准来定义行的排序顺序,否则就不会有“前几行”这样的东西。
鉴于您向我们展示的信息极其有限,您可能正在寻找以下内容:
select subno,
contrno, orderby, prepost_paid,
time_stamp,
lag(time_stamp) over (order by time_stamp) - time_stamp as timestamp_diff
from the_table
order by time_stamp;
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
6997 次 |
最近记录: |