Oracle滞后函数
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Oracle滞后函数相关的知识,希望对你有一定的参考价值。
A few examples of the LAG function.
SELECT * FROM student; --Example 1 SELECT student_id, first_name, last_name, fees_required, LAG(fees_required) OVER (ORDER BY fees_required ASC) AS prev_fees_required FROM student ORDER BY student_id ASC; --Example 2 SELECT student_id, first_name, last_name, fees_required, LAG(fees_required) OVER (ORDER BY fees_required ASC) AS prev_fees_required FROM student ORDER BY fees_required ASC; --Example 3 SELECT student_id, first_name, last_name, fees_required, LAG(fees_required, 3, 0) OVER (ORDER BY fees_required ASC) AS prev_fees_required FROM student ORDER BY fees_required ASC;
以上是关于Oracle滞后函数的主要内容,如果未能解决你的问题,请参考以下文章