LarryHudson
DTDrizzle Team
•Created by LarryHudson on 11/16/2023 in #help
SQLite - one to many relationship, join only returning first match
Hi everyone 🙂 I'm having an issue with my select query using Drizzle + SQLite3.
In my DB, a content item can have many content parts.
Here's my simplified schema in
src/db/schema.ts
:
And here's my select. I'm trying to select the content items but join to include the content parts:
When I run this select, it only picks up the first matching contentPart:
But I can find multiple matching content parts when I run db.select().from(contentPartsTable).where(eq(contentPartsTable.contentItemId, contentItemId))
.
Is there a way to include the array of all matching 'content_parts' when I run the first select query?19 replies