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
 want to find second max element in a table(Sql) ?

Author  Topic 

raghu
Starting Member

1 Post

Posted - 2005-09-28 : 08:43:56
I want to find 2nd max element in a Table . Pls Help me ?

raghu

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-09-28 : 08:50:13
SELECT MAX(Column1) FROM Tables WHERE Column1 < (SELECT MAX(Column1) FROM Table1)

Tara
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-09-28 : 08:52:54
Select min(Column1) from (Select top 2 Column1 from Table1 order by Column1 Desc) T

Madhivanan

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

- Advertisement -