How can I return number of rows that are returned from a grouped query without using a temporary table?
This question is certainly not rocket science, but it is often nice to know how many rows are returned as part of a group by. This might be for a report or a web query, where you would want to tell the user how many rows were returned on page one. It is easy using a temp table, but how to do it without a temp table is a little harder. I liked this solution and thought that it might not be obvious to everyone, it was certainly educational to me. Thanks go to Karl Jost for a very nice answer.
Related Questions
- When I run a query in isql, I always get two lines returned: the return status and the affected row count. Can the return status line be suppressed in isql?
- Should query against sys.database_principals return same number of rows as query against sys.sysyusers?
- Can I limit the number of rows returned by a query using the ICOBOL ODBC driver?