About aggregate functions
To summarize all the data in a table, you create an aggregate query
that involves a function such as SUM( ) or AVG( ). When you run the query,
the result set contains a single row with the summary information. For
example, you can calculate the total price of all books in the titles
table by creating a query that sums the contents of the price column.
For more information, see Group
Rows in query results.
For example, to calculate the number of rows in the Orders table, the
corresponding SQL statement might look like this:
SELECT SUM(*) FROM Orders
You can use the following aggregate functions:
Function |
Description |
AVG(expr) |
Average of the values in a column. The column can
contain only numeric data. |
COUNT(expr), COUNT(*) |
A count of the values in a column (if you specify
a column name as expr) or of all rows in a table or group (if you specify
*). COUNT(expr) ignores null values, but COUNT(*) includes them in the
count. |
MAX(expr) |
Highest value in a column (last value alphabetically
for text data types). Ignores null values. |
MIN(expr) |
Lowest value in a column (first value alphabetically
for text data types). Ignores null values. |
SUM(expr) |
Total of values in a column. The column can contain
only numeric data. |
Aggregate Functions in BaseNow Layout Toolbar
You can easily use aggregate functions in the program's main screen
on grouped rows using the Layout
Toolbar.
You can set aggregate functions for one or multiple columns. Just change
the ColumnName property and Function property to set the aggregate function
for a different column. Set the Function property to None to disable the
aggregate function for a column.
Function
Returns or sets the aggregate function to be shown in group footers
for a column.
ColumnName
Alows you to specify a column that will be used for calculations.
RowPrefix
Returns or sets the string displayed in a group footer row before the
aggregate function result.
RowFormat
Returns or sets a value indicating the format string for the aggregate
function result of a column in the group footer row.
Related Topics:
About calculations in a view
Create a calculate
column in a view
Specifying conditions
for groups
Group Rows in query results
About SQL Query Builder
SQL Query Builder Layout
|