Lucia
2007-07-21 19:40:07 UTC
Ciao a tutti, vorrei gestire una simulazione di combinazioni in SQL ma
non so come strutturare in modo corretto le tabelle e le query.
I would like simulate all combinations of the ingredients in a specific
prescriptions
I must to create the tables and query and I would like to know how to
manage a simulation
I have made some tests in Access (holding one table with one series of
values, pass, of type 0,100 0,200 0,300…) but Access does not seem to be
the software adapted.
I try to describe the problem
Table ingredients
Nome
Weight (always 100 for all ingredients )
Caratteristica1
Caratteristica2
Caratteristica3
...
Caratteristica7
In the prescriptions table I insert all ingredients of a specific
prescriptions
(I can set 10 as the maximum of ingredients that I can Insert in a
prescription ... for simplify the query)
Tabella Ricette:
prescriptionsName
ingredientsName (ingredients Table)
in this table I've the X ingrediets of the prescription
Now I want to simulate the combinations of X ingredients if I want to
have X weight of the prescription
fot all combination that has the X ingredients and that has specific
range for the "CaratteristicaX" column
Example
If I want 4000 Weight of a specific prescription (4000 is an user
information)
for each ingredients I must to do
(Caratteristica1/Weight(always 100))*4000
(Caratteristica2/Weight(always 100))*4000
(Caratteristica3/Weight(always 100))*4000
Now I've the value of each Caratteristica for the weight of the
prescripton (4000)
I sum all ingredientrs (with the Caratteristica value) and I've the
value of the "CaratteristicaX" for all prescription
I find the value of the Caratteristica in the total weight (4000):
totalCaratteristica1/4000*100 -> %
totalCaratteristica2/4000*100 -> %
totalCaratteristica3/4000*100 - %
Now I must to find all combination of ingredients (all ingredients of
the prescription) that has the sum of "Caratteristica" in the range
Caratteristica1 between 10% and 15%
Caratteristica2 between 20% and 50%
Caratteristica3 between 40% and 50%
Thanks for help me!!!
non so come strutturare in modo corretto le tabelle e le query.
I would like simulate all combinations of the ingredients in a specific
prescriptions
I must to create the tables and query and I would like to know how to
manage a simulation
I have made some tests in Access (holding one table with one series of
values, pass, of type 0,100 0,200 0,300…) but Access does not seem to be
the software adapted.
I try to describe the problem
Table ingredients
Nome
Weight (always 100 for all ingredients )
Caratteristica1
Caratteristica2
Caratteristica3
...
Caratteristica7
In the prescriptions table I insert all ingredients of a specific
prescriptions
(I can set 10 as the maximum of ingredients that I can Insert in a
prescription ... for simplify the query)
Tabella Ricette:
prescriptionsName
ingredientsName (ingredients Table)
in this table I've the X ingrediets of the prescription
Now I want to simulate the combinations of X ingredients if I want to
have X weight of the prescription
fot all combination that has the X ingredients and that has specific
range for the "CaratteristicaX" column
Example
If I want 4000 Weight of a specific prescription (4000 is an user
information)
for each ingredients I must to do
(Caratteristica1/Weight(always 100))*4000
(Caratteristica2/Weight(always 100))*4000
(Caratteristica3/Weight(always 100))*4000
Now I've the value of each Caratteristica for the weight of the
prescripton (4000)
I sum all ingredientrs (with the Caratteristica value) and I've the
value of the "CaratteristicaX" for all prescription
I find the value of the Caratteristica in the total weight (4000):
totalCaratteristica1/4000*100 -> %
totalCaratteristica2/4000*100 -> %
totalCaratteristica3/4000*100 - %
Now I must to find all combination of ingredients (all ingredients of
the prescription) that has the sum of "Caratteristica" in the range
Caratteristica1 between 10% and 15%
Caratteristica2 between 20% and 50%
Caratteristica3 between 40% and 50%
Thanks for help me!!!