Generating multiple records from a single record

G

Guest

I want to generate multiple records from a single record such that the sum of
each of the multiple records equals a value in the single record. I.e. I have
a record that states that I need to manufacture 100 units of product x. I
wish to create 25 production orders each to manufacture a quantity of 4.

I can do this by maintaining a table with one number field and values:
1;2;2;3;3;3;4;4;4;4 etc. but this is a bit messy. Is there any slicker way to
do this without resorting to coding?
 
C

Chris M

samwardill said:
I want to generate multiple records from a single record such that the sum
of
each of the multiple records equals a value in the single record. I.e. I
have
a record that states that I need to manufacture 100 units of product x. I
wish to create 25 production orders each to manufacture a quantity of 4.

I can do this by maintaining a table with one number field and values:
1;2;2;3;3;3;4;4;4;4 etc. but this is a bit messy. Is there any slicker way
to
do this without resorting to coding?

Is a production order always going to be in units of 4? If not, where does
this 4 come from?
 
G

Guest

The number is not always 4. This value comes from a product data record in
another table
 
C

Chris M

The only thing I can think of, is what I think you already suggested.

Have a table that just contains a single column containing the numbers
1-9999

Then somthing like:

Insert into NewTable (Quantity)
(
Select UnitQty from
<suitable sub-query to get single row containing qty required and unitqty
from other tables>,
NumbersTable
Where NumbersTable.Number <= QtyRequired/UnitQuantity
)

Hmmm, that's not quite right, I haven't got time to work it out properly
just now, but hopefully you get the gist?

Regards,

Chris.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top