How do you separate in pages database results?
-
Hi, Working in a time tracking program, I've thought of separating results in pages. I think of making a specific SQL query to count the amount of total registers with the applied filters, then call the another SQL query with LIMIT clause to be able to define from which record I want to start showing the results and the amount of results. Is there any better way to do it? Thank you in advance!
-
Hi, Working in a time tracking program, I've thought of separating results in pages. I think of making a specific SQL query to count the amount of total registers with the applied filters, then call the another SQL query with LIMIT clause to be able to define from which record I want to start showing the results and the amount of results. Is there any better way to do it? Thank you in advance!
See this article for various ways to return "pages" of data: https://blog.sqlauthority.com/2017/02/26/pagination-sql-server-interview-question-week-111 Alternatively, if you are using a Grid control to display the data, then I believe it has built in paging functionality.