JOIN Two temporary tables to interigate a third
Posted on 2002-05-22
I have a situation where I need to find all the records in one table that match all the records in one table and all the records in a second.
Temp Table 1 contains:
Temp Table 2 contains:
I only want to return the records from talbe three that match a combination of a and b so:
677 and 12 (OK)
688 and 12 (OK)
700 and 12 (NOT OK)
What I'm looking for is something similar to:
SELECT AnswerID FROM AppraisalDetails A JOIN #QuestionIDs TQ,#Appraisals TA ON A.QuestionID= TQ.QuestionID AND A.AppraisalID=TA.AppraisalID
Which isn't correct I know but you might get an idea of what I'm trying to achieve.
Hope this makes sense.