How to summarize values for all rows (Enterprise Manager)
To summarize values for all rows
- Start the query by adding the table you want to summarize to the Diagram pane.
- Right-click anywhere in the Diagram, Grid, or SQL panes, and choose Group By. The Query Designer adds a Group By column to the grid in the Grid pane.
- Add the column you want to summarize to the Grid pane. Be sure that the column is marked for output.
The Query Designer automatically assigns a column alias to the column you are summarizing to create a useful column heading in query output. For more details, see Creating Column Aliases.
- In the Group By grid column, select the aggregate function that you want to use to summarize the data: Sum, Avg, Min, Max, Count. If you want to summarize only unique rows in the result set, choose an aggregate function with the DISTINCT options, such as Min Distinct. Do not choose Group By, Expression, or Where, because those options do not apply when you are summarizing all rows.
- If you want to create more than one summary in the query, repeat steps 3 and 4.
When you add another column to the query output list or order by list, the Query Designer automatically fills the term Group By into the Group By column of the grid. Select the appropriate aggregate function.
- Add search conditions, if any, to specify the subset of rows you want to summarize.
When you execute the query, the Results pane displays the summaries that you specified.
Note The Query Designer maintains aggregate functions as part of the SQL statement in the SQL pane until you explicitly turn off Group By mode. Therefore, if you modify your query by changing input sources or changing its type, the resulting query might include invalid aggregate functions.
(c) 1988-98 Microsoft Corporation. All Rights Reserved.