Class: SelectStart<TProjection>
Class: SelectStart<TProjection>
Section titled “Class: SelectStart<TProjection>”Defined in: core/src/query/builder.ts:98
Result of db.select() or db.select(projection). Delays construction of
the concrete AST until .from(t) is called so the source table is known.
Type Parameters
Section titled “Type Parameters”TProjection
Section titled “TProjection”TProjection = NoProjection
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new SelectStart<
TProjection>(engine,projection):SelectStart<TProjection>
Defined in: core/src/query/builder.ts:99
Parameters
Section titled “Parameters”engine
Section titled “engine”projection
Section titled “projection”Returns
Section titled “Returns”SelectStart<TProjection>
Methods
Section titled “Methods”from()
Section titled “from()”from<
T>(t):SelectBuilder<{ [K in string]: InferRow<T> },TProjection>
Defined in: core/src/query/builder.ts:104
Type Parameters
Section titled “Type Parameters”T extends AnyTable
Parameters
Section titled “Parameters”T
Returns
Section titled “Returns”SelectBuilder<{ [K in string]: InferRow<T> }, TProjection>
fromSubquery()
Section titled “fromSubquery()”fromSubquery<
TInnerBuilder>(inner,alias):SelectBuilder<Record<string,any>,TProjection>
Defined in: core/src/query/builder.ts:125
Use a subquery as the FROM source. The subquery’s rows appear under
the given alias so the outer query can reference columns.alias. Use
for FROM (SELECT ...) AS alias shapes and CTE-style aggregations.
const active = db.select({ userId: todos.userId, cnt: count() }) .from(todos).groupBy(todos.userId)db.select().fromSubquery(active, "active") .where(gt(colRef("active", "cnt"), 3))Type Parameters
Section titled “Type Parameters”TInnerBuilder
Section titled “TInnerBuilder”TInnerBuilder extends { $ast: SelectQuery; }
Parameters
Section titled “Parameters”TInnerBuilder
string
Returns
Section titled “Returns”SelectBuilder<Record<string, any>, TProjection>