Anoop Bansal

Anoop Bansal

  • NA
  • 58
  • 6.3k

Get SQL Data last to first

Feb 24 2017 3:09 PM
Please look at the attached image
 
I am having 1000s of rows in purchase table, I want the fetch 10 rows each in desending order (date), like bottom to first, as that we use in pagination.
 
Suppose I have 30 rows then the output will be
30-20
20-10
10-1
 
how can I achieve this?
if I use 
SELECT TOP 10 * FROM purchase ORDER BY date DESC 
 
then I am getting 30-20 rows then the next row will be fetch 20-10 and then 10-1 (until it reaches the top row)
 
Please help 
 
 

Answers (12)