compute Clause

The Transact-SQL compute clause extension is used with the row aggregate functions sum, max, min, avg, count, and count_big to calculate summary values.

Queries that include a compute clause display results with both detail and summary rows. These reports resemble those produced by almost any database management system (DBMS) with a report generator. compute displays summary values as additional rows in the results, instead of as new columns.

Related concepts
Aggregates, Grouping, and Sorting