# mergeFrom

open fun <D : Table, S : Table> D.mergeFrom(source: S, on: () -> Op<Boolean>? = null, body: MergeTableStatement.() -> Unit): MergeTableStatement

Represents the SQL statement that inserts, updates, or deletes records in a target table based on a comparison with a source table.

#### Return

A MergeTableStatement that can be executed.

#### Parameters

source

An instance of the source table.

on

A lambda function that should return an `Op<Boolean>` condition. This condition is used to match records between the source and target tables.

body

A lambda where MergeTableStatement can be configured with specific actions to perform when records are matched or not matched.

open fun <T : Table> T.mergeFrom(selectQuery: QueryAlias, on: () -> Op<Boolean>, body: MergeSelectStatement.() -> Unit): MergeSelectStatement

Represents the SQL statement that inserts, updates, or deletes records in a target table based on a comparison with a select query source.

#### Return

A MergeSelectStatement which represents the MERGE operation with the configured actions.

#### Parameters

selectQuery

The aliased query for a complex subquery to be used as the source.

on

A lambda that returns an `Op<Boolean>` condition. This condition is used to match records between the source query and the target table.

body

A lambda where MergeSelectStatement can be configured with specific actions to perform when records are matched or not matched.