Constructing more complex joins #2041
Unanswered
felipesere
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Given a
shoppinglists
that can have manyingredients
which in turn can have manyquantities
(e.g. you need to buy 4 apples for a cake but also 6 apples to just eat), I have a query like this gathers all that data up:I have manually executed the statement and used FromQueryResult with the adequate prefixes to reconstruct my models.
Then I've done a bunch of looping and aggregating to arrive at
let result: Vec<(Shoppinglist, Vec<(Ingredient, Vec<Quantity>))>>
.Is there a way to construct such a query through the normal composition functions?
Ideally, I'd be able to finalize it with either
.all(..)
or.one(..)
depending on my needs...Beta Was this translation helpful? Give feedback.
All reactions