Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
glant
Starting Member
2 Posts |
Posted - 2011-01-15 : 00:25:48
|
Hi,I have a recipe table and ingredients table which has a one-to-many relationship where each recipe has multiple ingredients. I am trying to create a query that will return each recipe that has the specified ingredients. The specified ingredients is a dynamic list where the user can continually add or remove items to be include. For example:RECIPEid NAME1 Recipe12 Recipe23 Recipe3RECIPE_INGREDIENTSid fk_reicpe_id fk_ingredient_id1 1 12 1 23 2 14 2 35 3 16 3 27 3 4INGREDIENTSid ingredient1 milk2 egg(s)3 water4 sugar so if the user enters milk recipe 1,2,3 will be returned. If the user adds egg(s) in addition to milk the result would be 1,3. If the user adds sugar in addition to milk and eggs recipe 3 would be returned.Any help would be greatly appreciated. |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
|
|
glant
Starting Member
2 Posts |
Posted - 2011-01-15 : 23:27:47
|
| Thank you very much for your reply. Those blogs were very helpful! |
 |
|
|
|
|
|