
- Forum
- Databases
- SQL Server - Give example of mixmize and minimum salary find.
-
Contributing Member
Re: Give example of mixmize and minimum salary find.
Replace "n" with the no. u want to get the nth highest salary.
select *
from emp e1
where ( n =
( select count ( distinct ( e2.sal ) )
from emp e2
where e2.sal >=e1.sal))
-
Expert Member
Re: Give example of mixmize and minimum salary find.
You may get the result using the following query also
select level, max('col_name') from my_table
where level = '&n'
connect by prior ('col_name') > 'col_name')
group by level;
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules