---
///
import { Recipe, Ingredient, db, eq } from 'astro:db';
const ingredientsByRecipe = await db
.select({
name: Ingredient.name,
recipeName: Recipe.title,
})
.from(Ingredient)
.innerJoin(Recipe, eq(Ingredient.recipeId, Recipe.id));
console.log(ingredientsByRecipe);
---
Shopping list
{
ingredientsByRecipe.map(({ name, recipeName }) => (
-
{name} ({recipeName})
))
}