获取部门当前manager的薪水状况
获取所有部门当前manager的当前薪水情况,给出dept_no, emp_no以及salary
http://www.nowcoder.com/questionTerminal/4c8b4a10ca5b44189e411107e1d8bec1
From 并列两表 + group by去重 + order by排序
select d.dept_no,d.emp_no,s.salary from dept_manager as d,salaries as s where d.emp_no = s.emp_no and d.to_date = '9999-01-01' and s.to_date = '9999-01-01' group by salary order by d.dept_no asc;
也可以使用内连接
select d.dept_no,d.emp_no,s.salary from dept_manager as d inner join salaries as s on d.emp_no = s.emp_no where d.to_date = '9999-01-01' and s.to_date = '9999-01-01' group by salary order by d.dept_no asc;