The inner_join()
method builds a query that produces all combinations of two queries'
outputs that together meet some condition. It's a wrapper for SQL's
INNER JOIN
.
For any queries l
, r
,
you can call l
.inner_join(
r
,
condition
)
provided that:
condition
is an abstract_mapper<bool>
(in practice it will be a predicate
).
l
and r
's value
mappers will both be visible
to condition
.
l
.inner_join(
r
,
condition
)
returns a conditional_junction
(that's a kind of query) with the following characteristics:
std::tuple<
Tl
,
Tr
>
, where Tl
and Tr
are l
and r
's value types respectively.
tuple_mapper<
Tl
,
Tr
>
, whose two member mappers are
identical to l
and r
's
value mappers respectively.
std::tuple
s,
formed from each combination of the outputs of l
and r
, for which condition
evaluates to true
.
l
.inner_join(
r
,
condition
)
is interchangeable with l
.join(
r
).where(
condition
)
, which has exactly the same characteristics.
const query<std::tuple<screen, movie>> current_screenings = screens.inner_join(movies, screens->current_movie_id == movies->id);