Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 top 3 records

Author  Topic 

rameshabap988
Starting Member

5 Posts

Posted - 2011-05-18 : 09:29:41

Hi Experts,

How to get top 3 records from table.EMP Table field SAL...
Ex:SAL
4
5
2
8
9
The out put should like
9
8
5
Could you please any one help me...

Thanks&Regards
Ramesh

X002548
Not Just a Number

15586 Posts

Posted - 2011-05-18 : 09:31:46
SELECT TOP 3 SAL FROM EMP ORDER BY SAL DESC

Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2011-05-30 : 07:24:58
More methods
http://beyondrelational.com/blogs/madhivanan/archive/2007/08/27/find-nth-maximum-value.aspx

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -