Rows to columns
jvjmohanMay 19 2011 — edited May 19 2011Hi all
I have data in this format
Table 1 - Manager
Name | ID
Mgr1 | 1
Mgr2 | 2
Talbe 2 - Employee
EName | EID | MgrID
Emp1 | 1 | 1
Emp2 | 2 | 1
Emp3 | 3 | 1
Emp4 | 4 | 1
Emp11 | 11 | 2
Emp12 | 12 | 2
Emp13 | 13 | 2
Emp14 | 14 | 2
Join is Employee.mgrid = Manager.id
I need the output in this format
Name | ID | Employees
Mgr1 | 1 | Emp1,Emp2 ,Emp3 ,Emp4
Mgr2 | 2 | Emp11,Emp12 ,Emp13 ,Emp14
I am working Oracle 10g and have to use only sql. If there is an existing thread please direct me.
I have checked for xmlagg but its not allowed in our setup.
Thanks,
Vijay