# Join

class Join(val table: ColumnSet) : ColumnSet

Represents a join relation between multiple column sets.

## Constructors

Join
Link copied to clipboard
constructor(table: ColumnSet, otherTable: ColumnSet, joinType: JoinType = JoinType.INNER, onColumn: Expression<*>? = null, otherColumn: Expression<*>? = null, lateral: Boolean = false, additionalConstraint: SqlExpressionBuilder.() -> Op<Boolean>? = null)
constructor(table: ColumnSet)

## Properties

columns
Link copied to clipboard
open override val columns: List<Column<*>>

Returns the columns of this column set.

fields
Link copied to clipboard
open override val fields: List<Expression<*>>

Returns the field of this field set.

lastQueryAlias
Link copied to clipboard
val Join.lastQueryAlias: QueryAlias?

Returns the most recent QueryAlias instance used to create this join relation, or `null` if a query was not joined.

realFields
Link copied to clipboard
open val realFields: List<Expression<*>>

Returns all real fields, unrolling composite CompositeColumn if present

source
Link copied to clipboard
open override val source: ColumnSet

Return the column set that contains this field set.

table
Link copied to clipboard
val table: ColumnSet

The column set to which others will be joined.

## Functions

alreadyInJoin
Link copied to clipboard
fun alreadyInJoin(table: Table): Boolean

Return `true` if the specified table is already in this join, `false` otherwise.

crossJoin
Link copied to clipboard
open infix override fun crossJoin(otherTable: ColumnSet): Join

Creates a cross join relation with otherTable.

delete
Link copied to clipboard
fun Join.delete(targetTable: Table, vararg targetTables: Table, ignore: Boolean = false, limit: Int? = null): Int

Represents the SQL statement that deletes all rows from a table in a join relation.

inline fun Join.delete(targetTable: Table, vararg targetTables: Table, ignore: Boolean = false, limit: Int? = null, where: SqlExpressionBuilder.() -> Op<Boolean>): Int

Represents the SQL statement that deletes rows from a table in a join relation.

@JvmName(name = "deleteJoinNullableParam")
fun Join.delete(targetTable: Table, vararg targetTables: Table, ignore: Boolean = false, limit: Int? = null, where: SqlExpressionBuilder.() -> Op<Boolean>? = null): Int
describe
Link copied to clipboard
open override fun describe(s: Transaction, queryBuilder: QueryBuilder)

Appends the SQL representation of this column set to the specified queryBuilder.

fullJoin
Link copied to clipboard
open infix override fun fullJoin(otherTable: ColumnSet): Join

Creates a full outer join relation with otherTable.

innerJoin
Link copied to clipboard
open infix override fun innerJoin(otherTable: ColumnSet): Join

Creates an inner join relation with otherTable.

join
Link copied to clipboard
open override fun join(otherTable: ColumnSet, joinType: JoinType, onColumn: Expression<*>?, otherColumn: Expression<*>?, lateral: Boolean, additionalConstraint: SqlExpressionBuilder.() -> Op<Boolean>?): Join

Creates a join relation with otherTable. When all joining options are absent Exposed will try to resolve referencing columns by itself.

joinQuery
Link copied to clipboard
fun Join.joinQuery(on: SqlExpressionBuilder.(QueryAlias) -> Op<Boolean>? = null, joinType: JoinType = JoinType.INNER, lateral: Boolean = false, joinPart: () -> AbstractQuery<*>): Join

Creates a join relation with a query.

leftJoin
Link copied to clipboard
open infix override fun leftJoin(otherTable: ColumnSet): Join

Creates a left outer join relation with otherTable.

rightJoin
Link copied to clipboard
open infix override fun rightJoin(otherTable: ColumnSet): Join

Creates a right outer join relation with otherTable.

select
Link copied to clipboard
fun select(columns: List<Expression<*>>): Query

Creates a `SELECT` Query using a list of columns or expressions from this ColumnSet.

fun select(column: Expression<*>, vararg columns: Expression<*>): Query

Creates a `SELECT` Query by selecting either a single column, or a subset of columns, from this ColumnSet.

select
Link copied to clipboard
inline fun FieldSet.select(where: SqlExpressionBuilder.() -> Op<Boolean>): Query
fun FieldSet.select(where: Op<Boolean>): Query
selectAll
Link copied to clipboard
fun FieldSet.selectAll(): Query

Creates a `SELECT` Query by selecting all columns from this ColumnSet.

selectAllBatched
Link copied to clipboard
fun FieldSet.selectAllBatched(batchSize: Int = 1000): Iterable<Iterable<ResultRow>>
selectBatched
Link copied to clipboard
fun FieldSet.selectBatched(batchSize: Int = 1000, where: SqlExpressionBuilder.() -> Op<Boolean>): Iterable<Iterable<ResultRow>>
slice
Link copied to clipboard
fun slice(columns: List<Expression<*>>): FieldSet
fun slice(column: Expression<*>, vararg columns: Expression<*>): FieldSet
targetTables
Link copied to clipboard
fun ColumnSet.targetTables(): List<Table>

Returns the list of tables to which the columns in this column set belong.

update
Link copied to clipboard
inline fun Join.update(limit: Int? = null, crossinline body: (UpdateStatement) -> Unit): Int

Represents the SQL statement that updates all rows of a join relation.

inline fun Join.update(where: SqlExpressionBuilder.() -> Op<Boolean>, limit: Int? = null, crossinline body: (UpdateStatement) -> Unit): Int

Represents the SQL statement that updates rows of a join relation.

@JvmName(name = "updateJoinNullableParam")
fun Join.update(where: SqlExpressionBuilder.() -> Op<Boolean>? = null, limit: Int? = null, body: (UpdateStatement) -> Unit): Int