ยฉ 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Drizzle TeamDT
Drizzle Teamโ€ข15mo agoโ€ข
4 replies
Brokenwind

Unable to sort relational query

The docs says this should work:

await db.query.posts.findMany({
    orderBy: (posts, { asc }) => [asc(posts.id)],
    with: {
        comments: {
            orderBy: (comments, { desc }) => [desc(comments.id)],
        },
    },
});
await db.query.posts.findMany({
    orderBy: (posts, { asc }) => [asc(posts.id)],
    with: {
        comments: {
            orderBy: (comments, { desc }) => [desc(comments.id)],
        },
    },
});


But for some reason, this doesn't work out on my end. Is this still a bug or there's a workaround for this?
Drizzle TeamJoin
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
11,879Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Nullable relational query?
Drizzle TeamDTDrizzle Team / help
3y ago
Relational query problem
Drizzle TeamDTDrizzle Team / help
3y ago
Relational query, Planetscale throws: `ResourceExhausted desc = Out of sort memory`
Drizzle TeamDTDrizzle Team / help
3y ago
advanced relational query builder
Drizzle TeamDTDrizzle Team / help
3y ago