COUNT

COUNT({ * | [ DISTINCT | ALL ] expr }) [ OVER (analytic_clause) ]

SELECT ENAME,
       E.HIREDATE,
      COUNT(EMPNO) OVER(ORDER BY HIREDATE RANGE BETWEEN 30 PRECEDING AND 30 FOLLOWING) AS CNT
      FROM EMP E
    WHERE TO_CHAR(HIREDATE,'YYYY')='1981';
ENAME      HIREDATE           CNT
---------- ----------- ----------
ALLEN      1981/2/20            2
WARD       1981/2/22            2
JONES      1981/4/2             2
BLAKE      1981/5/1             2
CLARK      1981/6/9             1
TURNER     1981/9/8             2
MARTIN     1981/9/28            2
KING       1981/11/17           3
FORD       1981/12/3            3
JAMES      1981/12/3            3
posted @ 2014-12-21 15:17  智能先行者  阅读(285)  评论(0编辑  收藏  举报