© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Drizzle TeamDT
Drizzle Team•3y ago•
2 replies
josefkjaergaard

Ordering by relation in relational query

I am trying to sort on an attribute of a relation using the relational queries api, but as far as I can tell it is not supported?

Example:
await db.query.city.findMany({
    orderBy: (country    , { asc }) => [asc(country.name)],
    with: {
        country: true,
    },
});
await db.query.city.findMany({
    orderBy: (country    , { asc }) => [asc(country.name)],
    with: {
        country: true,
    },
});


Thanks,
J
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

Subquery/join in relational query
Drizzle TeamDTDrizzle Team / help
3y ago
Relational query builder in mysql?
Drizzle TeamDTDrizzle Team / help
3y ago
Simple relational query in sqlite
Drizzle TeamDTDrizzle Team / help
3y ago
Nullable relational query?
Drizzle TeamDTDrizzle Team / help
3y ago