Aggregates
Introduction
Starcounter SQL supports five different aggregates: AVG
, SUM
, COUNT
, MAX
, and MIN
. These can be used with grouping and conditions on groups with the GROUP BY
and HAVING
clauses.
Example
Using Asterisk Shorthand With COUNT
COUNT
The asterisk shorthand is treated as a literal in COUNT
. Since Db.SQL
doesn't support literals, using COUNT(*)
in Db.SQL
will throw ScErrUnsupportLiteral (SCERR7029)
.
There are three ways to work around this:
The first option of using an identifier to get the count best in most cases, both for versatility and performance.
Last updated