I think the question is : what is the MYsql statement to do this

it would be possible in 1 round if mysql would work with subselects (select into where clauses). Since its not, i think several passes will be needed to find the recipe.
like for example :
Code:
select tradeskill_recipe.id from tradeskill_recipe,tradeskill_recipe_entries where tradeskill_recipe.id=tradeskill_recipe_entries.recipe_id and item_id=[item1id] and componentcount=[item1nb]
-> returns the recipes which need item1nb of item1id
if there's more than 1 answer, we test them with the second item
point A
Code:
select tradeskill_recipe.id from tradeskill_recipe,tradeskill_recipe_entries where tradeskill_recipe.id=tradeskill_recipe_entries.recipe_id and tradeskill_recipe.id=[answer1] and item_id=[item1id] and componentcount=[item1nb]
if there's a result to this, we keep that recipe_id as a possible result, and process to the next previous answers.
At the end, if we have only 1 recipe_id left, we found the recipe, if no, 2 possibilities :
- our recipe has 2 components and both are a part of the components of another recipe (or there's 2 similar recipes, but this may consider as an error from the world builder)
- there are several recipes that match 1st and 2nd components, we have to test for the 3rd one and restart at
point A.
That's not the only way to do this, another one would be to do a query, of the kind :
Code:
select distinct tradeskill_recipe.id
from tradeskill_recipe,tradeskill_recipe_entries
where tradeskill_recipe.id=tradeskill_recipe_entries.recipe_id and
(
(item_id=[item1id] and componentcount=[item1count])
or (item_id=[item2id] and componentcount=[item3count])
..
or (item_id=[itemnid] and componentcount=[itemncount])
)
that will return all the recipes containing each of our items (with the good componentcounts). Then process backway and test all the recipes found to see if they match the items from the combine container...
I ve tested this, its longer to describe than to do. Of course, its more time consuming than the queries on the previous table, but tradeskill combines arent that frequent... another possibility, wait till subselects are implemented into mysql
[/u]