QBCountAggregate

Overview

The QBCountAggregate class represents aggregate expressions, such as count, min, and max, within a QBSelect query. It provides a range of methods and properties for constructing and manipulating aggregate expressions, allowing for customization of query results and conditions.

Aggregates can be used to calculate summaries, apply mathematical functions, or manipulate data within a query. Properties like count, sum, and avg allow direct creation of aggregate expressions, while others like abs or round perform mathematical operations. Sorting and conditional operations can also be applied using properties such as asc, desc, and isNull.

Methods extend the functionality of aggregates by enabling operations like comparison (eq, between, like), mathematical manipulation (plus, minus, mod), and substring extraction (substring). These features provide fine-grained control over how aggregate data is computed and retrieved.

The QBCountAggregate class integrates with query builder constructs like QBColumn, QBCondition, and QBSort, enabling complex query logic and data transformations.

Extends

QBColumn

Properties Summarized

Type
Name
Summary

Add a distinct qualifier to the aggregate

Properties Detailed

distinct

Add a distinct qualifier to the aggregate

Type QBColumn

Sample

// count the number of countries that we ship orders to
var query = datasources.db.example_data.orders.createSelect();
query.result.add(query.columns.shipcountry.count.distinct);

Last updated

Was this helpful?