select t.title , avg(s.salary) avg
from salaries s join titles t
on s.emp_no = t.emp_no
and t.to_date='9999-01-01'
and s.to_date='9999-01-01'
group by title
;
/* 各个title类型对应的员工 group by title