ANY dialect question:
please answer my question from correlated queries
select * from emp e where 2<=(select count(distinct(sal)) from emp where e.sal<sal);
the above query gives us the top 3 earners.
but when i am executing the query in other format i.e
select * from emp where 2<=(select count(distinct(sal)) from emp e where e.sal>sal);
for this i am not able get top 3 earners . CAN U GIVE ME THE REASON PLEASE
the difference in both queries is i have interchanged the alias e in the outer query and inner query
|