Union Query and Where Clause

A

alexander199

Is it is possible to apply WHERE clause to the entire result of the
UNION query?

Something like this:

(Select f1 from A
UNION
Select f1 from B)
where f1 = '1';

I tried to parenthesize the individual selects but it does not work.
So I had to put the where clause in each individual select to filter
the result.
Thanks.
 
K

Ken Snell \(MVP\)

Not within the UNION query itself. You'd need to save the UNION query and
then write a different query that uses that UNION query as the data source,
and then put the WHERE clause in that new query:

SELECT * FROM UNIONQuery
WHERE FieldName = "value";
 

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

Single WHERE and ORDER clause in UNION? 4
Union Query and Field Alias 7
Duplicates in union query 3
SUM in a UNION query 2
Union query 5
union query problem 16
Union Query 1
Stumped by Union Query 3

Top