Pepo
Pepo
DTDrizzle Team
Created by Pepo on 12/26/2023 in #help
Filter Posts by categories?
I'm learning drizzle and I've come to a wall, how do i filter posts by category id bringing posts with all their respective categories? const postsByCategory = await db .select() .from(postsOnCategories) .leftJoin(posts, eq(postsOnCategories.postId, posts.id)) .leftJoin(categories, eq(postsOnCategories.categoryId, categories.id)) .where(eq(categories.id, 3)); This brings all posts that contain the referenced category but i want them with their category relations so i can show them in cards.
8 replies