where

abstract fun where(clause: Clause.(T) -> Unit): SelectStatement<T>

Adds a WHERE clause to the SELECT statement, filtering the result set.

The WHERE clause is used to extract only those records that fulfill a specified condition. You provide the conditions within a lambda expression, using the provided Clause receiver and the table instance T.

This function can be called only once per SELECT statement. Subsequent calls will overwrite the previously defined WHERE clause.

Example

// Selects employees from the "Sales" department who are older than 30.
val cursor = Employees
.select(Employees.firstName, Employees.lastName)
.where {
(Employees.department EQ "Sales") AND (Employees.age GT 30)
}
.execute()

// Process the results
cursor.forEach { row ->
// ...
}

Return

The SelectStatement instance, allowing for further chaining of query-building methods.

Author

MOHAMMAD AZIM ANSARI

Parameters

clause

A lambda expression with a Clause receiver that defines the filtering conditions. The lambda also receives the table instance T to provide typed access to its columns.

See also