© 2026 Hedgehog Software, LLC

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

Lateral Left Joins in Drizzle Core Queries

I am creating a more complex Postgres query that requires me to drop down to the sql abstractions of drizzle (my query needs to use window functions and group bys). In this same query, I would like to return a column that includes a list of relations, ideally as a JSON array. My initial instinct was to try to recreate the lateral left join query, similar to how the drizzle query builder returns relations using the
with
with
option.
However, in my reading of the documentation and the code, it doesn't appear that there is a way to access lateral left joins using the
db.select()...
db.select()...
syntax. Reading through the code, it doesn't seem like the
lateral
lateral
option is exposed as part of a public API.
I expect I might be able to write a subquery or a CTE in order to achieve this goal, but I was wondering whether there was anything I was missing/any way I could more easily replicate how drizzle achieves this goal?
Thanks!
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

Lateral joins
Drizzle TeamDTDrizzle Team / help
17mo ago
Lateral joins
Drizzle TeamDTDrizzle Team / help
2y ago
Drizzle Queries in Drizzle Studio
Drizzle TeamDTDrizzle Team / help
3y ago
aggregation core queries in extras?
Drizzle TeamDTDrizzle Team / help
16mo ago