U kunt een subquery gebruiken om duplicaten te verwijderen:
select department_id, count(*),
listagg(manager_id, ' | ') within group (order by manager_id)
from (select distinct department_id, manager_id
from employees
) e
group by department_id