I need help in making two queries into one query

A

Alex Martinez

Hello,

I have two queries which are different due to its complexity, but has the
same number of data fields. Query 1 has no unique field, query 2 does have
a unique fields. I like to make it into one query for example:

Query 1 (All fields are now shown for simplicity)
Policy Number Insured Policy Dates Policy Type
A111 XYZ 1/1/2006 AG


Query 2 (All fields are now shown for simplicity)
Policy Number Insured Policy Dates Policy Type
A317 ABC 2/1/2006 HD


I like this get this results merging the two queries into one:

Policy Number Insured Policy Dates Policy Type
A111 XYZ 1/1/2006 AG
A317 ABC 2/1/2006 HD


Is this possible? Any tips will be appreciated. Thank you in advance.
 
A

Allen Browne

Use a UNION query to combine the 2 into one. The results will be read only.

1. Switch both queries to SQL View. (View menu, in query design.)

2. Remove the final semicolon from Query1.
Enter:
UNION ALL

3. Paste in the entire statement from the other query.

You will end up with something like this:
SELECT ...
UNION ALL
SELECT ...

If you want the query results sorted, only the last SELECT should have an
ORDER BY clause.
 

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

Top