Total Pageviews

January 3, 2019

1/03/2019 01:22:00 AM
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
 
Related Posts Plugin for WordPress, Blogger...