select s.emp_no,s.salary,last_name,first_name
from 
employees e
inner join
salaries s
on e.emp_no=s.emp_no
having s.salary=(select max(s1.salary) from salaries s1
where s1.salary<(
    select max(s2.salary) from salaries s2
))

这道题恶心就恶心在需要用group by ,但明显是一个无意义的操作。

记得要用group by 后面加上 你join 的字段,不然会报错