Aggregate Function - Mitsubishi Electric MELSEC iQ-R-R00CPU User Manual

Melsec iq-r series cpu module application user's manual
Table of Contents

Advertisement

Aggregate Function

AVG
This command obtains a mean value.
Syntax
AVG ([numeric expression])
■Application example
• To obtain the mean value of fld1 from table1 (including overlapped values)
SELECT AVG ("fld1") FROM "table1";
• To obtain the mean value of fld1 from table1 (excluding overlapped values)
SELECT AVG (DISTINCT "fld1") FROM "table1";
COUNT
This command aggregates the number of records.
Syntax
COUNT [target]
■Application example
• To obtain the number of records of fld1 from table1 (including overlapped values)
SELECT COUNT ("fld1") FROM "table1";
• To obtain the number of records of fld1 from table1 (excluding overlapped values)
SELECT COUNT (DISTINCT "fld1") FROM "table1";
MAX
This command obtains a maximum value.
Syntax
MAX ([numeric expression])
■Application example
• To obtain the maximum value of fld1 from table1
SELECT MAX ("fld1") FROM "table1";
MIN
This command obtains a minimum value.
Syntax
MIN ([numeric expression])
■Application example
• To obtain the minimum value of fld1 from table1
SELECT MIN ("fld1") FROM "table1";
SUM
This command obtains the total.
Syntax
SUM ([numeric expression])
■Application example
• To obtain the total of fld1 from table1 (including overlapped values)
SELECT SUM ("fld1") FROM "table1";
• To obtain the total of fld1 from table1 (excluding overlapped values)
SELECT SUM (DISTINCT "fld1") FROM "table1";
APPX
1002
Appendix 14 List of Available SQL Commands for CPU Module Database Access Function

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents