Display items - Linked tables - Many to many relationship

I have two tables Recipes and Items. I want to be able to show all of the items that are linked to a recipe.
I am using Supabase and these items are linked together through a separate linked table with only the id’s of the recipe and the item. So I have 3 tables called “Recipe”, “Item” and the lock table which I’ve called “Item in recipe link”

I am trying to display the items inside a div below the recipe name. I am used to a different no code platform which goes about this in a different way so I’m trying to learn how to do this in Weweb.
So far I have the Recipe in a div that has the Recipe collection bound to it and inside that div is the text that is bound to the recipe name.
Next I have a div that has text inside it. I want to be able to display all of the items information in this div including name, description etc.

On the items div should I be setting the “items in recipe link” collection or the “items” collection? I was trying to set the “items in recipe link” collection and then filter by the current recipe id. That’s where I get lost.
Is there a video explaining this type of scenario.

And also is there a trick to putting more text items inside a div once it’s bound to a collection. It doesn’t seem to let you do that unless that text is already bound to the same collection

You can apply the same logic used here

For more info, check out how to make Supabase Views, it’s fairly simple.

Thanks… I’ll look into this and see how I go

I got this to work. Thanks.

However I need to go deeper.
Inside the items table that is linked via the item_recipe link relationship there are also other relationships.
I have relations setup but when I reference this in the view it only shows the ID. The view code is below.

create view
item_recipe_view as
select
recipe.recipe_id,
recipe.recipe_name,
item.item_id,
item.item_name,
item.item_description,
item.usecase_id, (This is the line that I need to access the name on instead of just the ID. It comes from a separate table called usecase and the column I need is called usecase_name)
item_recipe_link.item_in_recipe_qty

from
item_recipe_link
left join recipe on item_recipe_link.recipe_id = recipe.id
left join item on item_recipe_link.item_in_recipe_id = item.id;

Could you show the schema of your tables? Is the name in a different table referenced by the ID?

The usecase is linked to the items. I am trying to show the usecase name (not the ID).

I am trying to have a Recipe as the main line and then nested inside that in a row below is any item that is linked to that recipe. The item line needs to have all of the items from the items table. See below. The items collapse and you only see a list of recipes until you expand it to see the items inside.

then you just join the two tables ON usecase_id

item i join usecase u on i.usecase_id = u.id

and then select u.name, or something like that, I can’t see the other one, how it’s structured

Am i supposed to type this at the end of the same view query?

I get a destructive error.
Also where do you do the u.name part? I was able to do all of this before with no code but this is a different approach so im just a bit lost.
I have attached the supabase view query and the usecase and items collections.

Image below: Supabase view query error

Image below: “usecase” collection

Image below: “item” collection

Image below: “item_in_recipe_link” collection

I appreciate your help.

join usecase u on u.id = item.usecase_id

Thanks. I’ll try that

Yeah, if I had access to the supabase sql editor, it would be simpler, doing these things remotely is a little tidious. Hopefully this will work though)