Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query within a query

Status
Not open for further replies.

TimTDP

Technical User
Feb 15, 2004
373
ZA
In Access 2000, I have a table called "tblRecipe"
I also have the following tables that are linked to tblRecipe:
tblSupplierIngredient and tblOwnRecipe

A recipe can be made by simply only having SupplierIngredients. However a recipe can also be made by having SupplierIngredients and a recipe in tblRecipe (stored in tblOwnRecipe)

My problem is calculating the cost of a recipe. If the recipe only consists of SupplierIngredients the calculation is easy. However I am struggling to calculate the cost of a recipe if it contains a combination of SupplierIngredients and an OwnRecipe because the OwnRecipe may include an OwnRecipe so I don't know the cost of the new recipe

any ideas on how to solve this?

 
How many "OwnRecipie"s could appear in a recipe?

If there's never more than one then you can pull it off but if it's an arbitrary number then you need to either write some code to do this or look at some more advanced techniques like nested sets to structure your tables.

At a minimum, we would need to see a bit more of your table layouts to see how this might be done.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top