Subqueries support in db.select()
#3981
AlexBlokh
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Drizzle ORM allows you to build subqueries and pass them to
db.select().from(subquery)
, yet drizzle is missing subqueries in list of select params which prevents you from doing very handy SQL statements likeTo address this we wanna ship support for drizzle subqueries in list of select params which will let you do
while you now have a handy
db.$count()
operator which does exactly that and yes, we're going to widen list of convenient aggregation $operators, this is meant to cover more of the SQL and unlock further improvements with the subsequent release ofdb.select(count()).from(users)
and more advanced aggregations likeThis API is already supported in our relational queries v2 in
extras
fieldsUPD 1:
we don't need to enforce users to pass subquery with mandatory
.as()
, we are safe to providekey
name as aas
value to SQL query if.as
is absent.PS: this will finally close #361
Beta Was this translation helpful? Give feedback.
All reactions