sql第六题

查找所有员工入职时候的薪水情况

http://www.nowcoder.com/questionTerminal/23142e7a23e4480781a3b978b5e0f33a

第一种方法
select a.emp_no, a.salary from salaries a,employees b
where a.emp_no = b.emp_no and a.from_date=b.hire_date order by b.emp_no desc

第二种
select a.emp_no, a.salary from salaries a,
(
SELECT emp_no,min(from_date) as mindate FROM salaries GROUP BY emp_no
) b where a.emp_no=b.emp_no and a.from_date =b.mindate order by a.emp_no desc

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务