题解 | #查找入职员工时间排名倒数第三的员工所有信息#
查找入职员工时间排名倒数第三的员工所有信息
http://www.nowcoder.com/practice/ec1ca44c62c14ceb990c3c40def1ec6c
方法一:使用order by 进行排序并用limit 2,1选中倒数第三的员工信息
代码: select * from employees order by hire_date desc limit 2,1
代码: select * from employees order by hire_date desc limit 2,1
方法二:运用子查询,可以处理当有多个员工在同一天入职的情形
代码: select * from employees where hire_date = (select distinct hire_date from employees order by hire_date desc limit 2,1)