SQL代码:
select '部门编号:'||a.dept_id||'部门名称:'||b.dept_name||'年龄最大为:'||a.age
from
(select a.dept_id,a.age,dense_rank()over(partition by a.dept_id order by a.age desc) d_rank
from tb_wyh_user_info a
order by a.dept_id desc ) a,
tb_wyh_dept_info b
where a.dept_id=b.dept_id
and a.d_rank<=1;