"Group By" string concatenation in Oracle

SELECT LPAD(' ', 2*level-1)||SYS_CONNECT_BY_PATH(last_name, '/') "Path"
   FROM employees
   START WITH last_name = 'Kochhar'
   CONNECT BY PRIOR employee_id = manager_id;

Path
---------------------------------------------------------------
 /Kochhar
   /Kochhar/Greenberg
     /Kochhar/Greenberg/Faviet
     /Kochhar/Greenberg/Chen
     /Kochhar/Greenberg/Sciarra
     /Kochhar/Greenberg/Urman
     /Kochhar/Greenberg/Popp
   /Kochhar/Whalen
   /Kochhar/Mavris
   /Kochhar/Baer
   /Kochhar/Higgins
     /Kochhar/Higgins/Gietz

 

 

with tableA as
(
select 'a' a,'123' b from dual
union
select 'a' a,'456' b from dual
)
select a,Wm_Concat(b) from tableA group by a
Path
---------------------------------------------------------------
a 123,456

 

group by 字符串连接

你可能感兴趣的:(by,group,字符串连接,orace)