Oracle分析函数FIRST_VALUE、LAST_VALUE
FIRST_VALUE、LAST_VALUE分析函数可以按照特定分组和排序去除组内首尾值,语法 FIRST_VALUE { (expr) [ {RESPECT | IGNORE} NULLS ] | (expr [ {RESPECT | IGNORE} NULLS ]) } OVER (analytic_clause) 测试下 10:48:07 SCOTT@study> SELECT EMPNO, 10:48:15 2 DEPTNO, 10:48:15 3 SAL, 10:48:15 4 FIRST_VALUE(SAL) IGNORE NULLS OVER(PARTITION BY DEPTNO ORDER BY SAL) AS LOWEST_IN_DEPT, 10:48:15 5 FIRST_VALUE(SAL) IGNORE NULLS OVER(PARTITION BY DEPTNO ORDER BY SAL ROWS 1 PRECEDING) AS PRECEDING_IN_DEPT, 10:48:15 6 LAST_VALUE(SAL) IGNORE NULLS OVER(PARTITION BY DEPTNO ORDER BY SAL) AS HIGHEST_IN_DEPT, 10:48:15 7 LAST_VALUE(SAL) IGNORE NULLS OVER