select
dept_name,
wm_concat(real_name) as con_real_name
from (
select '销售部' as dept_name,'小红' as real_name from dual
union all
select '销售部' as dept_name,'小明' as real_name from dual
union all
select '销售部' as dept_name,'小张' as real_name from dual
union all
select '销售部' as dept_name,'张三丰' as real_name from dual
)
where real_name in('小张','张三丰','小明')
group by dept_name