Skip to content
Discussion options

You must be logged in to vote

There is unfortunately now database independent way to express this behavior as part of your sql query. Postgres provides the array_agg aggregate function that could be used in combination with group by to express such a behavior. I'm not aware similar extensions for other database systems.
Another solution for this problem is to use separate queries here based in the API provided by diesel::associations. Entity::belonging_to(...) only returns a query that can be used with other QueryDsl methods like joins or select clauses.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@publicarray
Comment options

@weiznich
Comment options

@publicarray
Comment options

Answer selected by publicarray
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants