AaronT
4Penny.net
Points: 7650

1/19/2017 12:38:25 PM

Paging query contest

* This article, and all our great SQL (General) documentation, Is available on the SQL (General) menu

OK, technically a contest has to have a prize, so... you'll be 'King of the Site' for a day. That's the prize. <big smile>

I came across a requirement to provide item numbers in files of 200. So, if there are 1100 items, there would be 5 files with 200, and the last would have 100.

The general idea behind this is 'paging'

I've done this before with different levels of success, this is the first that I've coded in SQL.

The query below provides a 'Start Item' and an 'End Item' in groups of 200 for the IV00101.

Can anyone see a more elegant way to do it?

Remember: King of the Site!

4Penny.net
Version: All
Section: SQL Scripts
Table Definition Quick Links
All Tables
SOP Tables
RM Tables
GL Tables
POP Tables
HR Tables
PM Tables
UPR Tables
IV Tables
Olympic Tables
3