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

Only return X number of records

Status
Not open for further replies.

Scorez2000

Programmer
Feb 5, 2004
87
GB
I'm writing my own first discussion board in ASP.

I want to run a query to pull out the latest 20 threads. However, There may end up being thousands of threads in the database. Creating a query with 1000s of records will not be very efficient.

Is it possible to order the records by date and then only select the top 20 records to appear in my recordset?

Thanks in advance,
Wayne
 
SELECT TOP 10 table.field, table.field2...."

Easy as that.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top