code_junkie

There are a method to paging using ANSI Sql only

Nov 13th, 2011
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. SELECT * FROM (
  2. SELECT thiscol, thatcol, ROW_NUMBER() OVER (ORDER BY mtime DESC, id) AS rownumber
  3. )
  4. WHERE rownumber BETWEEN 10 AND 20 -- care, 1-based index
  5. ORDER BY rownumber;
  6.  
  7. ANSI Sql example:
  8. offset=41, fetchsize=10
  9.  
  10. SELECT TOP(10) *
  11. FROM table1
  12. WHERE table1.ID NOT IN (SELECT TOP(40) table1.ID FROM table1)
Add Comment
Please, Sign In to add comment