Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Oracle SQL :LISTAGG function

LISTAGG – LISTAGG (measure_expr [, ‘delimiter_expr’]) WITHIN GROUP (ORDER
BY clause) [OVER PARTITION BYclause]
 Scenario:
consider following table.We need to find aggregate results dept wise in form of rows.
Employee table:
Employee_numEmployee_nameDepartment IDSalary
1sekhar100100000
2Vidya100200000
3Nilesh101300000
Query used:
select Department_ID,listagg(Employee_name,’,’) within group(order by Employee_name) as Employee_name from Employee group by Department_id;
Output:
Department IDEmployee_name
100sekhar,vidya
101Nilesh


This post first appeared on EBiz Integration Technics, please read the originial post: here

Share the post

Oracle SQL :LISTAGG function

×

Subscribe to Ebiz Integration Technics

Get updates delivered right to your inbox!

Thank you for your subscription

×