I have complex query which returns milions of row. I use pager like "results 1-20 of 1235416" and I select only the 20 rows per page to be quick. But the query "Select Count(ID) from " is very slow, because it resolves all the complex query even if is quite optimized. It would be fine for me to show to user:
result 1-20 of more than 1000... like the google.
How should the following query looks like?
Select Count(Id) but no more than 1000 from <complexQuery>.
It would be fine if it is compatible with mssql, mysql and sqlite.