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
 Select Max Query

Author  Topic 

munkdogg
Yak Posting Veteran

53 Posts

Posted - 2008-01-25 : 09:14:45
Good morning,

I am trying to capture the 25 largest records in a table using a Select Max statement. My results thus far only return the largest single record...can someone assist me in expanding the statement below to capture the additional records? Many thanks to all who respond!

SELECT max(DocSize) FROM dbo.table1

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-01-25 : 09:32:05
SELECT TOP 25 * FROM dbo.table1 ORDER BY DocSize DESC
Go to Top of Page

jackv
Master Smack Fu Yak Hacker

2179 Posts

Posted - 2008-01-25 : 09:33:31
SELECT TOP 25 DocSize , col2,.. FROM table1 ORDER BY DocSize DESC





Jack Vamvas
--------------------
Search IT jobs from multiple sources- http://www.ITjobfeed.com
Go to Top of Page

munkdogg
Yak Posting Veteran

53 Posts

Posted - 2008-01-25 : 09:40:02
Perfect, thank you!
Go to Top of Page
   

- Advertisement -