Suppose that you are given the following simple database table called Employee that has 2 columns named Employee ID and Salary:
Employee Employee ID S
without nested query
select max(e.salary) as max_salary, max(e1.salary) as 2nd_max_salary from employee as e left join employee as e1 on e.salary != e1.salary group by e.salary desc limit 1;