select title, avg(salary) from salaries, titles where salaries.to_date='9999-01-01' and titles.to_date='9999-01-01' and salaries.emp_no=titles.emp_no group by titles.title;
select title, avg(salary) from salaries, titles where salaries.to_date='9999-01-01' and titles.to_date='9999-01-01' and salaries.emp_no=titles.emp_no group by titles.title;