My application performs a number of queries with the general form:
SELECT <aggregate-functions>
FROM <table-name>
WHERE <where-clause>
GROUP BY <group-by column list>
I would like to know how many records contributed to the aggregate result set (in other words, how many records matched the conditions in the WHERE clause), something that is hidden because of both both the aggregate functions in the SELECT clause and the GROUP-BY clause. I know that I could do a simple SELECT COUNT(*) using the same WHERE clause to get that number, but I would like to avoid a second query if at all possible. Is there a SQL Server feature/function/etc that will produce that value without another query?