Home » SQL & PL/SQL » SQL & PL/SQL » Several rows data in a column adding in one row group by catagory (ORACLE 11g)
icon9.gif  Several rows data in a column adding in one row group by catagory [message #623851] Mon, 15 September 2014 08:16 Go to next message
ocpsujon
Messages: 8
Registered: April 2014
Location: Gazipur, Bangladesh
Junior Member

Please see this..

SELECT DEPARTMENT_ID, EMPLOYEE_ID FROM EMPLOYEES;

Result:

DEPARTMENT_ID	EMPLOYEE_ID
10	          200
20	          201
20	          202
30	          114
30	          115
30	          116
30	          117
30	          118
30	          119
40	          203
60	          103
60	          104
60	          105
60	          106
60	          107
70	          204
90	          100
90	          101
90	          102
100	          108
100	          109
100	          110
100	          111
100	          113
100	          112
110	          205
110	          206



I want to see this in the following way..

Result:

DEPARTMENT_ID	EMPLOYEE_ID
10	          200
20	          201, 202
30	          114, 115, 116, 117, 118, 119
40	          203
60	          103, 104, 105, 106, 107
70	          204
90	          100, 101, 102
100	          108, 109, 110, 111, 112, 113
110	          205, 206


Please help me to make me the query.
Re: Several rows data in a column adding in one row group by catagory [message #623859 is a reply to message #623851] Mon, 15 September 2014 09:01 Go to previous messageGo to next message
Lalit Kumar B
Messages: 3174
Registered: May 2013
Location: World Wide on the Web
Senior Member
Search for LISTAGG, you will find numerous examples.
Re: Several rows data in a column adding in one row group by catagory [message #623885 is a reply to message #623859] Mon, 15 September 2014 22:04 Go to previous message
ocpsujon
Messages: 8
Registered: April 2014
Location: Gazipur, Bangladesh
Junior Member

Thanks a lot Mr. Lalit Kumar B

[Updated on: Mon, 15 September 2014 22:06]

Report message to a moderator

Previous Topic: Need procedure to execute CLOB as paramter
Next Topic: Compare two rows from a same table
Goto Forum:
  


Current Time: Fri Mar 29 05:38:47 CDT 2024