Aggregates
Introduction
Example
SELECT AVG(e.Salary), MAX(e.Salary), MIN(e.Salary), e.Department
FROM Example.Employee e
GROUP BY e.Department
HAVING SUM(e.Salary) > 20000Using Asterisk Shorthand With COUNT
COUNT// This throws SCERR7029
Db.SQL("SELECT COUNT(*) FROM Person").First();
// Using an identifier instead of * works
Db.SQL("SELECT COUNT(p) FROM Person p").First();
// Db.SlowSQL supports literals, so it can be used
Db.SlowSQL("SELECT COUNT(*) FROM Person").First();
// Linq can also give you the number of rows
Db.SQL("SELECT p FROM Person p").Count();Last updated