Let’s see a simple example to see, how exactly we can obtain entire employee name who obtains top 10 salaries.
Assuming that we have following table for Employee.
| EmpId || EmpName || EmpSalary |
select Employee.EmpName,Employee.EmpSalary from Employee where Employee.EmpSalary in (select distinct top(10)Employee.EmpSalary from Employee order by Employee.EmpSalary desc)OUTPUT:-
You will be also interested in watching the below video, which are also asked in most of the interviews and favourable question of interviewers.
write a comment