Union Query and Where Clause

  • Thread starter Thread starter alexander199
  • Start date Start date
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.
 
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
MS 2003 Parameterized Query 0
Union Query and Field Alias 7
Stumped by Union Query 3
Union Query Syntax Error 2
Union Query 2
Selective Union 1
Union Query Problem 5

Back
Top