Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting SQL results in parts

I know i can limit the count of received results using the TOP keyword, but is there a way to receive the next let say 1000 results using something like <give me the next 1000 results> which gives me each time the next cached 1000 ones?

So assume my query has 100000 and the first run i get 1-1000 i would like to receive the 1000-2000 and so on.


1 Answers

When the data is changing between queries, rownum/between solutions will give you approximations of the next chunk of data.

If you need to get a specific chunk of data from a fixed result, insert all of the results into a table and then consume the data as needed. The results will stay fixed until you refresh the data in the table again.

This works well when you must get the exact next set (forward or backward). This might be useful, depending on your situation.

like image 186
Scott Bruns Avatar answered Nov 21 '25 22:11

Scott Bruns



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!