Summarize all rows matching criteria
- Last UpdatedJan 11, 2023
- 2 minute read
- PI System
- PI Server 2024 R2
- PI Server
The Summarize all rows matching criteria rule enables you to perform a summary operation on the rows in a table column that match your selection criteria.
Syntax
SELECT summary(column) FROM table WHERE where clause; options and parameters
Arguments
-
SELECT summary(column)
If a column name contains non-alphanumeric characters, including spaces, it must be enclosed in [ ] brackets.
You can select one of the following summary operations.
Operation
Description
Sum
The total of all row values.
Avg
The average of all row values.
Min
The minimum value of all rows.
Max
The maximum value of all rows.
Count
The number of rows.
StDev
The extent of deviation for all row values.
Var
The average measure of how far all row values differ from the mean.
None
When no operation is specified:
-
If the result attribute is not an array, the value of the selected column in the first row that matches the WHERE clause is returned.
-
If the result attribute is an array, an array with one value from each column of all rows that match the WHERE clause is returned.
-
-
FROM table
If a table name contains non-alphanumeric characters, including spaces, it must be enclosed in [ ] brackets.
-
WHERE clause
For more information on WHERE clause syntax, see WHERE clause syntax.
-
Options
You can enter the following options in a list separated by semicolons.
Stepped
When set to True, the returned value plots as stepped in applications.
TZ=time zone
Specifies the time zone of the source table.
Note: Set the time zone in the general description of the table, so that you do not need to specify it with each table lookup.
UOM=uom
Specifies the unit of measure for the value returned by the result column.
Note: You can also set the unit of measure in the table column definition, so that you do not need to specify it with each table lookup.
RWM=value
Specifies the value to return when there is no column match. If the value is No Data, the digital state of No Data is returned.
RWN=value
Specifies the value to return when the result column is null. If the value is No Data, the digital state of No Data is returned.
-
Parameters
You can enter parameters in a list separated by semicolons. Begin each parameter name with the @ character in @parameter=value format (value is described in "Attribute or Value" in WHERE clause syntax). For additional information on using parameters, see Parameters for linked table queries.