nth Salary Flow
Hi Guys, Can anybody let me understand how this query is working.
I am confused in flow of query.. Plz tell me how the flow is going on... Thanks in advance
from employees a
where 2=(select count(distinct(b.salary))
from employees b
What does the table look like? I'm guessing that the second column in the table is the number of people who make a certain salary.
No its not like that.. ialso used explain plan but could not understand the flow
Do you grasp the "inline view" concept?
Originally Posted by umeshgupta1987
Nth salary Continuee...
I do understand the inline view concept.. But its a correlated sub query.. i m confused for only fetching the nth highest.. how we r getting that nth highest salary by providing 2 or 3 or something else.....
distinct() is defining salary levels.
inline view is counting how many lower salary levels are for each salary level.
main query is using counting as reference number a.k.a. Nth