码迷,mamicode.com
首页 > 其他好文 > 详细

LISTAGG

时间:2014-12-21 16:27:26      阅读:156      评论:0      收藏:0      [点我收藏+]

标签:

LISTAGG(measure_expr [, ‘delimiter‘])
  WITHIN GROUP (order_by_clause) [OVER query_partition_clause]

 SELECT DEPARTMENT_ID "Dept",
           HIRE_DATE "Date",
           LAST_NAME "Name",
           LISTAGG(LAST_NAME, ‘; ‘) WITHIN GROUP(ORDER BY HIRE_DATE, LAST_NAME) OVER(PARTITION BY DEPARTMENT_ID) AS "Emp_list"
      FROM EMPLOYEES
     WHERE TO_CHAR(HIRE_DATE, ‘YYYY‘) < ‘2003‘
     ORDER BY "Dept", "Date", "Name";
 Dept Date        Name                      Emp_list
----- ----------- ------------------------- -------------------------
   30 2002/12/7   Raphaely                  Raphaely
   40 2002/6/7    Mavris                      Mavris
   70 2002/6/7    Baer                         Baer
   90 2001/1/13   De Haan                   De Haan
  100 2002/8/16   Faviet                     Faviet; Greenberg
  100 2002/8/17   Greenberg               Faviet; Greenberg
  110 2002/6/7    Gietz                       Gietz; Higgins
  110 2002/6/7    Higgins                   Gietz; Higgins

LISTAGG

标签:

原文地址:http://www.cnblogs.com/wwxbi/p/4176641.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!