select ifnull( (select distinct salary as SecondHighestSalary from Employee order by salary desc limit 1 offset 1) ,null) as SecondHighestSalary 要点 第二高的薪水可能为空,用ifnull解决。 内层select语句形成了一个临时表