Skip to content

Tag: many-to-many

Get distinct members for an array of group IDs

I have 3 tables: Scorecard Group Scorecard_Group (Joint table) I am trying to write a query that fulfills the following purpose: Get the list of distinct scorecard ids WHERE Scorecard_Group.groupId IN (Pass array of groupIds) Get all Scorecard.”name” where Scorecard.”id” IN (Array of scorecardIds that we just queries) I am able to achieve this using 2 queries but I would

Find a record containing all or a part of a list of id of other table in a many-to-many relation on MySql/Jpa?

In my web application, I have 3 tables: TAB A: Recipes (id, name) TAB B: Recipes_Ingredients(id, fk_recipe,fk_ingredient, quantity) Bridge table TAB C: Ingredients (id, name) I need to find all the recipes(TAB A) that containing a provided list of ingredients (TAB C). Es: I provide a list of ingredients id like 111 (spaghetti), 222(pepper), 333(oil) and I need to find

How to perform Many to Many Relationship Filter Query

I want to perform a query in MySQL based on a filter. First of all, the two tables that will be used in the query are the following: Equipment: Field Type Id PK, Integer Name Varchar(50) Recipe: Field Type Id PK, Integer Name Varchar(50) The relationship between the two tables is Many-to-Many, so there is a pivot table. The filter