Postgres json_agg
How can I create this equivalent using drizzle?
I cannot find any article in the docs.
6 Replies
The syntax is very close, you don't really need the alias but if you want you can define them before:
Thank you!
I'd suggest you also use the
.mapWith()
method on the sql
operator to parse the json you'll get from the driver and give it the correct type
I believe the way it is right now, brand
and variant
will be inferred as unknown
Another BTW: the RQB api does this for you if you have your relations properly defined