Subqueries

J

Josh

Becky,
A proper sub query uses the In keyword like this:

SELECT ID, OptionID WHERE OptionID IN( SELECT txtOne,
txtTwo, txtThree)

I don't think this will work for what you're doing.

Try a union query like this:

qryOne:
SELECT ID, OptionID FROM table WHERE OptionID = txtOne OR
txtTwo

qryTwo:
SELECT ID, OptionID FROM table WHERE OptionID = txtThree
OR txtFour

qryFinal:
SELECT qryOne.ID UNION SELECT qryTwo.ID

This will probably work for what you are trying to do.

Usually there is an alternative to using either Union or
Sub queries, but if your users insist on having 30
nested 'ors' then good luck.

HTH,
Josh
 
Top