How to list the ingredients that make up a dish?

How to list the ingredients that make up a dish?

  

How to list the ingredients that make up a dish?


Data Model:



But the same ingredient always appears instead of listing the different ingredients of each dish.




Hi Projeto,

That means your query is wrong :). The datamodel seems ok, even though it doesn't follow best practice naming of attributes (I'd advise to use PratoId and IngredientesId, so Service Studio knows what they are from the name).

Given a dish, you need to join the dish composition Entity to it ("Prato only with PratoComposicao") with a join condition on the dish Id ("Prato.Id = PratoComposicao.IDPrato"), then join the composition Entity with the ingredients Entity ("PratoComposicao only with Ingredientes") with a join condition on the ingredients Id ("PratoComposicao.IDIngredientes = Ingrediented.Id). That should do the trick.