Skip to main content

GroupColumn

Represents one GROUP BY column, optionally schema/table-qualified. Select#groupBy() builds GroupColumn instances internally for every string you pass. Extends BaseField.

Constructor

GroupColumn(value: string): GroupColumn
new GroupColumn(value: string): GroupColumn

Dual-callable. value must match [[schema.]table.]field — anything else throws a TypeError ("does not match group column format").

import { Select } from '@sqb/builder';

Select('country', 'count(*)').from('customers').groupBy('country');
// ... group by country

Select().from('customers').groupBy('schema1.customers.country');
// ... group by schema1.customers.country

Properties

KeyTypeReadonlyDescription
_typeSerializationType.GROUP_COLUMNYesDiscriminates this node during serialization.
_fieldstringNoThe unqualified column name.
_tablestring | undefinedNoTable qualifier, if present in value.
_schemastring | undefinedNoSchema qualifier, if present in value.

Plus everything inherited from BaseField.

Methods

GroupColumn has no chainable methods — it exposes only its serialization logic. Reserved words in _field are escaped (double-quoted) automatically when serialized.

See also