题解 | #查找入职员工时间排名倒数第三的员工所有信息#
查找入职员工时间排名倒数第三的员工所有信息
http://www.nowcoder.com/practice/ec1ca44c62c14ceb990c3c40def1ec6c
select *
from employees
where hire_date=(
SELECT t1.hire_dateFROM employees t1
inner join employees t2
on t1.emp_no != t2.emp_no AND t1.hire_date<t2.hire_date
GROUP BY t1.emp_no
HAVING COUNT(distinct t2.hire_date)=2);