I am very close to getting this running, but at the moment my code leaves me with the required number of rows, but the same 500 or so rows repeated over and over.
Any pointer would be much appreciated.
Here's my code:
// recTotal already found by a previous query = 111,532;