Assume that there are 4 tables, with association tables "between" each of them:

  1. Machines
  2. Products
  3. Option Groups
  4. Options

Machines may serve many products, and a product may "belong to" many machines. Products have many Option Groups and an option group can belong to multiple products. The same relationship exists between Option Groups and Options.

Ideally, I'd like to return all of the data for a "menu" (there is not a menus table - that's just how I'm referring to a group of products that belong to a machine) in a single call, but I'm struggling to get things working right.

Any help, including a simple nudge in the right direction, would be very much appreciated!

  • Please consider reading this advice – mustaccio May 23 '19 at 20:10
  • Sounds like you need a string of JOINs that connect the 4 Entity tables via the 3 Relationship (mapping) tables. – Rick James May 23 '19 at 22:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.