We help IT Professionals succeed at work.

Match all fields against a lookup table

518 Views
Last Modified: 2012-05-11
Hi Experts,

Forgive me if this is a basic question but I haven't been able to find a resource online that answers this.

I'm trying to apply an array of conditions to a SQL SP.  To do so I want to take a lookup table

RecipeID, CategoryID
1,1
1,2
2,1
2,2
2,3
2,5
3,4
4,1
4,2
4,3
4,4

and return the RecipeID's for all records that match ALL of the variables in a table variable

CategoryID
1
2
3

With results like:

Result
2
4


Any Hints?

Thanks!

Michael











Comment
Watch Question

Software Engineer
CERTIFIED EXPERT
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
Doh! Thanks! I was over thinking it with odd joins.

Author

Commented:
Actually, this doesn't solve the issue...

This pulls ANY matches... I need it to pull matches that ALL fields match.

Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.