You can do this with a simple GROUP BY / HAVING query:
select account
from t
group by account
having count(distinct salesperson) > 1
This returns the accounts, so the result is different from what you specify. One way to get sellers to use listagg:
select account, listagg(salesperson, ',')
from t
group by account
having count(distinct salesperson) > 1
Otherwise, Gareth's answer returns the results as you indicated in the question.
source
share