Group By Clause (SQL)

Help Contents

Introduction

The SQL Group By clause groups selected rows into a summary. One row is returned for each group.

Syntax

GROUP BY grouping-element-list

grouping-element-list ::=
  grouping-element [ { ',' grouping-element } ]

grouping-element ::=
  value-expression

Remarks

A value-expression in the Group By clause can be a single column or an expression combining multiple columns. At least one column must be included.

When a Group By clause is present, each element in the Select List must be referenced by:

If Aggregate Functions are included in the Select clause, one summary value is calculated for each group.

Example

To quickly find out how many of each type of tag are in Fernhill SCADA:

Select TypeName,Count(*)
From TagCore
Group By TypeName

Further Information

Set Functions (SQL)

To learn more about the SQL set grouping functions.

Fernhill SCADA Structured Query Language (SQL)

To learn more about the SQL features in Fernhill SCADA.

Glossary

For the meaning of terms used in Fernhill SCADA.