Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting the bottom of a list

Status
Not open for further replies.

timely

Programmer
Jun 7, 2001
64
US
Ok, I know for getting the top 50 files I would do this:

Select Top 50 a, b, c
from data

but how I get the bottom 50?
 
Your syntax, while technically correct, will not return reliable results. There is no order to SQL Server data, so the only way to get a reliable TOP # is to supply an ORDER BY clause. Having said that, to obtain the rows from the bottom of a result set, switch the ORDER BY clause from DESC to ASC or ASC to DESC, depending on how it is currently defined.

--Angel [rainbow]
-----------------------------------
Every time I lose my mind, I wonder
if it's really worth finding.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top