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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select last 1000 rows in Table

Status
Not open for further replies.

saw15

Technical User
Jan 24, 2001
468
US
How do you reverse this:

select top 300 * from table

But instead of the top 300, I want the last 300. The field is not an integer so I can't use a subtraction calculation.

Any help is appreciated.
 
Hi,

If ur field is ordered by say field1
select top 300 * from table order by field1 ASC

then

select top 300 * from table order by field1 desc

will give u the last records to appear for the order by criteria.

Sunil
 
Sunil is correct, but you only need to run the second script (the one with the ORDER BY column DESC), not the first one.

-SQLBill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top