union
Appends a UNION operator to the current query, combining its result set with another SELECT statement.
The UNION operator combines the result sets of two or more SELECT statements and removes duplicate rows between them. The SELECT statements being combined must have the same number of columns in their result sets with similar data types.
Example:
Employees
.select(
Employees.firstName,
Employees.lastName,
StringLiteral("Employee") AS "Type",
).union {
Customers.select(
Customers.firstName,
Customers.lastName,
StringLiteral("Customer"),
)
}.execute(con)Content copied to clipboard
This would generate SQL similar to: SELECT * FROM Employees WHERE department = 'Sales' UNION SELECT * FROM Employees WHERE department = 'Marketing';
Return
A new SelectStatement representing the combined query.
Author
MOHAMMAD AZIM ANSARI
Parameters
select
A lambda function that returns the SelectStatement to be combined with the current query.
Type Parameters
S
The type of the KQLiteTable being queried.