Link to home
Start Free TrialLog in
Avatar of mcunn
mcunn

asked on

Match all fields against a lookup table

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











ASKER CERTIFIED SOLUTION
Avatar of Ephraim Wangoya
Ephraim Wangoya
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mcunn
mcunn

ASKER

Doh! Thanks! I was over thinking it with odd joins.
Avatar of mcunn

ASKER

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

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