Question

I've been like a month trying to figure out this maybe its something very simple:

I have something similar to this Recipes table

Product     Ingredient  Qty

Lemonade    Lemon     2
Lemonade    Water     1
Lemonade    Sugar     6
Breakfast    Lemonade    1
Breakfast    Sandwich    1
Sandwich    Bread      2
Sandwich    Lettuce      1
Sandwich    Ham       3

And another table, Product, with the properties of each one

Concept     Type

Lemonade    Product
Breakfast    Action
Sandwich    Product
Lemon     Supplie
Water     Supplie
Sugar     Supplie
Bread     Supplie
Lettuce     Supplie
Ham      Supplie

this could be indefinitely nested Examp. adding Day, and nest breakfast, dinner, lunch etc. each one with its nested products and each products with its nested supplies

  • It is possible that in one query get the supplies used in a breakfast?

  • or I have to change the logic?

Was it helpful?

Solution

This is what we often call a “BOM” in database land. (Bill of materials). So you might have an “electric motor assembly” and then that goes to a fan assembly and then hat goes into an air condition unit. The ability to “add together” an un-limited amounts of assemblies is thus an often solved and requested problem in database land.

An Access example of such a design can be found here:

The http://access.mvps.org/access/modules/mdl0027.htm

The above is in Access 97, so you have to “import” the example into recent versions of Access before use. You can also do a BinGoogle for “BOM” database examples.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top