© 2026 Hedgehog Software, LLC

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

Count in relational queries

How do I count in relational queries? For example if i'm querying db.query.posts.findMany() and want to include an extra field that counts the number of likes (diff table), how can I achieve that? Couldn't make it work with the "extras" and trying to make a sql
count()
count()
there.

Thanks in advance
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

Error in relational queries
Drizzle TeamDTDrizzle Team / help
16mo ago
Subqueries in relational queries
Drizzle TeamDTDrizzle Team / help
3y ago
Bug: Count in Extras (Relational)
Drizzle TeamDTDrizzle Team / help
9mo ago
Conditional Relational Queries
Drizzle TeamDTDrizzle Team / help
3y ago