Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I need to write a sql query to display top 25 records with a catch

I need to write a query as follows which will be bound to a grid

select top 25 * from ErrTable Order by DateErrorad Desc

However, I need to write this query to return only 25 records at a time, but when a user clicks next it will display the next 25 most recent records from the db.

How could I accomplish this?

like image 209
Will Avatar asked Oct 11 '10 20:10

Will


1 Answers

You can implement a 'paging' technique using ROW_NUMBER() as detailed in this post: http://www.davidhayden.com/blog/dave/archive/2005/12/30/2652.aspx

like image 119
Alex Avatar answered Sep 28 '22 00:09

Alex