DT
Drizzle TeamDellgenius
How can I get a better structured response when querying a table (many to many)?
Hi, I am new to sql. This might be obvious, but I'm not sure how to go about this. Below is a simplified example of what I hope to achieve.
I have three tables:
orders
, order_lines
, and items
. order_lines
is a junction table. Here's how I'm currently fetching the data:
This results in a response like this:
Desired Output:
I want to structure the JSON to group order_lines
and items
under each order
:
Is there a way to to do this natively with drizzle, or do I need to manually process the results after fetching them? Would appreciate any help!arily•17d ago
Drizzle ORM - Query
Drizzle ORM is a lightweight and performant TypeScript ORM with developer experience in mind.
ZAZ•17d ago
is there a difference in use case for db.query vs. the partial selects? i'm also trying to figure out the same issue.
arily•16d ago
db.query have ORM DX and it’ll creates SQL automatically, while selects are simple query builders
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
7.4KMembers
View on DiscordWant results from more Discord servers?
More Postssql where column md5Hey, how can I achieve the following statement in drizzle?
```sql
-- mysql
SELECT * FROM podcasts_Error on Query Filter: Types of property 'table' are incompatible.I'm currently trying to filter a query as [explained in on the docs](https://orm.drizzle.team/docs/rHow to do Computed Fields / Manipulate data at Query Level?I'm looking for something like this, on prisma we can validate fields when querying the model. I coupgEnum conversion not working as expectedI have the following pgEnum defined:
```
export const ApprovalRequestTypePgEnum = pgEnum('approval_Filtering a jsonb with the shape Array<{id:string,name:string}>Hi. I have a query that returns all the posts with it's categories like this,
```typescript
type PosCan't update table columnI update the column's name in my schema, but it don't update when I check in Drizzle Studio.
AnyoneRunning an insert script, and I'm getting some "warnings".How do you access the warning details or what rows they relate to?drizzle-orm/libsql in cf workers causes type conflictsglobal fetch returns node Response type instead of Response type from @cloudflare/workers-types when