Scenario: I need to extract information from a Visual FoxPro database; however, when running large queries against this, there is a tendency to lock the system. To eliminate this, we set limits that canceled the request if it has passed a certain time, and the number of rows that it will return is limited.
Is there a way to get a query with "SELECT TOP ###", but also return the actual number of rows found in the statement? Or is this the only way to run a query twice? (the reason is that we can still fulfill the request, but we inform the user about what is happening, that is, "The first ### displays ### found items").
My initial research was simply to add “COUNT (*)” to the instruction selection part, but it didn’t quite fulfill what I was looking for (it returned the correct number of rows, but only one row was returned for the rest of the data).
source share