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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Duplicate Subform data 0
SQL Hel---p 12
union SQL programming 8
VBA works in orignal but fails in copy of database 1
Excel query help with union select 2
SUM in a UNION query 2
help needed 0
help needed 0

Top