Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Microsoft Access > Need for a recu...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 3 Topic 29952 of 31576
Post > Topic >>

Need for a recursive query

by Jim Devenish <internet.shopping@[EMAIL PROTECTED] > Apr 14, 2008 at 08:12 AM

I have a table named StockItems with field:
StockItemID
QuantityInStock

I am creating assemblies of stock items and have another table named
StockItemAssemblies with fields:
StockItemAssemblyID
AssemblyID
StockItemID
Quantity

I need to work out how many assemblies I have in stock from knowing
how many individual items are in stock and have the following query:

Select StockItemAssemblies.AssemblyID, Min(StockItems.QuantityInStock/
StockItemAssemblies.Quantity) As QuantityInStock
From StockItems Inner Join StockItemAssemblies On
StockItems.StockItemID = StockItemAssemblies.StockItemID
Group By StockItemAssemblies.AssemblyID

This works fine.  Elsewhere in the program the QuantityInStock from
this query is used in place of the QuantityInStock in the StockItems
table when the item is an assembly. For an assembly the
QuantityInStock in the StockItems table is thus ignored.

However a component of an assembly could be another assembly.

How do I modify the query to properly include all sub-assemblies?
 




 3 Posts in Topic:
Need for a recursive query
Jim Devenish <internet  2008-04-14 08:12:31 
Re: Need for a recursive query
Tom van Stiphout <no.s  2008-04-14 19:20:16 
Re: Need for a recursive query
Jim Devenish <internet  2008-04-15 00:53:53 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Dec 3 1:33:55 CST 2008.