|
业务需求:
实现方法:
先将后面的工资和部门可以通过group by得到
id是通过拼接的,oracle有相应的函数:wm_concat和LISTAGG(id,’,’) WITHIN GROUP( ORDER BY depon),得到:
使用的sql:
select LISTAGG(id,’,’) WITHIN GROUP( ORDER BY depon),sum(salary),depon
from test_1
group by depon;
select wm_concat(id) ,sum(salary),depon
from test_1
group by depon
|
|