Skip to content
Discussion options

You must be logged in to vote

I'm not sure you can do this using query. The best approach is probably to build your own query using select.

select({
    // getTableColumns is an utils from drizzle
     ...getTableColumns(post),
    author: ***aggregate author data here if needed???***
})
.from(post)
.innerJoin(author, eq(author.uuid, post.authorUuid)
.orderBy(desc(author.name))

if you need to aggregate author data, you will probably have to implement aggregate function like json_build_object in postgresql

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@marceloverdijk
Comment options

@marceloverdijk
Comment options

Answer selected by marceloverdijk
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants