I’m running a query that retrieves 20 rows (for example). I want to know if there are 21 so I can enable the ‘next page’ button accordingly. At the moment I’m retrieving pageSize + 1 and returning a boolean as an out parameter which is assigned it’s value based on whether there were 21 (in this case) rows retrieved but will only actually return the 20 as a List. This means I’m retrieving an extra one though which I then just disregard which isn’t ideal for performance and I don’t want to run a count(*) because it’s another query altogether.
NOTE: Using a pageddatasource isn’t really an option, got to stick with rowlimit’s and start rows.
Thanks for any suggestions.
You can use a nested query, something like this:
Then each row will have the total column, so you can check that.
Alternatively, you could use this syntax, avoiding the nested select. This will become more convenient when you have additional predicates (which don’t have to be repeated in the nested select):