SQL Help

  • Thread starter Thread starter Wee
  • Start date Start date

Wee

Wee

Associate
Joined
25 Apr 2006
Posts
130
Location
Scotland
Working on some web stuff at the moment, and have come across a problem. I have a table in my database that is choco-block full of rows, but only want to display the 5 latest entries instead of them all. I was wondering it there is an SQL statement that is able to only output a specific number of rows?
 
yes.

How are they indexed? if they are by a incrementing key number then order by that and get the last 5 records.

what columns are in the table and what database engine is it?
 
The database is SQL Server 2005.

They won't be indexed by an incremented key number, most likely will be done by date.
 
.....But yeah use his. It is more 'correct' than mine (even though both will work). I don't have a MSSQL server to test it on at home though!
 
Back
Top Bottom