join two queries

F

FL

I have two queries and each count like records for a certain field. The
results of each query has a different total of records for each result. For
example one query has 30 records and the other results in 15 records. The
data is accurate.

I want to join the two results and create a chart. Unfortunately, I'm
having trouble joining them into one query with the same results (30+15 = 45
records). I did join common fields but the results are short records.
 
J

John W. Vinson

I have two queries and each count like records for a certain field. The
results of each query has a different total of records for each result. For
example one query has 30 records and the other results in 15 records. The
data is accurate.

I want to join the two results and create a chart. Unfortunately, I'm
having trouble joining them into one query with the same results (30+15 = 45
records). I did join common fields but the results are short records.

You don't need a Join here - that joins two recordsets "side to side".
Instead, you need a UNION query. To create one, you must go to the SQL window:

SELECT thisfield, thatfield, theotherfield FROM firstquery
UNION ALL
SELECT somefield, anotherfield, athirdfield FROM secondquery;

The number and datatypes of the fields must match; as in my example, the names
need not.

See the online help for UNION for more details.

John W. Vinson [MVP]
 

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