cake/query/join
Functions to build JOIN clauses of SQL queries.
Tables, views and sub-queries can be joined together.
Supported join kinds
INNER JOINLEFT JOIN, inclusive, same asLEFT OUTER JOIN,RIGHT JOIN, inclusive, same asRIGHT OUTER JOIN,FULL JOIN, inclusive, same asFULL OUTER JOIN,CROSS JOIN
You can also build following joins using the provided query builder functions:
SELF JOIN: Use the same table, view, or sub-query with a different alias.EXCLUSIVE LEFT JOIN:WHERE b.key IS NULLEXCLUSIVE RIGHT JOIN:WHERE a.key IS NULLEXCLUSIVE FULL JOIN:WHERE a.key IS NULL OR b.key IS NULL
Functions
pub fn cross(with wth: JoinTarget, alias als: String) -> Join
Creates a CROSS JOIN.
Also called cartesian product.
pub fn full(
with wth: JoinTarget,
on on: Where,
alias als: String,
) -> Join
Creates a FULL JOIN.
Also called FULL OUTER JOIN.
Inclusive by default.
Set on to WHERE a.key IS NULL OR b.key IS NULL to make it exclusive.
pub fn inner(
with wth: JoinTarget,
on on: Where,
alias als: String,
) -> Join
Create an INNER JOIN.
pub fn left(
with wth: JoinTarget,
on on: Where,
alias als: String,
) -> Join
Creates a LEFT JOIN.
Also called LEFT OUTER JOIN.
Inclusive by default.
Set on to WHERE a.key IS NULL to make it exclusive.
pub fn right(
with wth: JoinTarget,
on on: Where,
alias als: String,
) -> Join
Creates a RIGHT JOIN.
Also called RIGHT OUTER JOIN.
Inclusive by default.
Set on to WHERE b.key IS NULL to make it exclusive.
pub fn sub_query(sub_query sq: Query) -> JoinTarget
Create a JOIN target from a sub-query.