Sunday, September 20, 2015

Oracle listagg function for 2 columns

select e.emp_no,
listagg (to_char(start_time,'dd-mm-yyyy hh24:mi'), ',')
WITHIN GROUP
(ORDER BY e.emp_no,c.work_date,start_time,end_time) start_times,
   listagg (to_char(end_time,'dd-mm-yyyy hh24:mi'), ',')
WITHIN GROUP
(ORDER BY e.emp_no,c.work_date,start_time,end_time) end_times
from emp e,come_leav c
where e.emp_no = c.emp_no
and   e.finshed = 2
GROUP BY
   e.emp_no,c.work_date 
/



Yasser

No comments:

Post a Comment