linking queries

E

EmoryKA

I have a database that tracks productivity. I want to take one query
"picking productivity" and link it to another query "loading productivity".
In the "picking productivity" query the employee name is in field [picker],
and in the "loading productivity" query the employee name is in field
[loader].

How can I write a query that will combine these two queries into one with
[picker] and [loader] becoming [employee]?

The goal is to add the productive time spent picking and loading under this
one field [employee].

Thanks for your assistance.
 
R

Roger Carlson

You can use a UNION query to do this. Something like this:

SELECT picker AS employee
FROM [picking productivity]
UNION ALL
SELECT loader
FROM [loading productivity]

This will get you all the names listed in a column "employee". Presumably
you want other fields. You can add them, but there has to be the same
number of fields in the field list of each query. They don't have to be
named the same. The field names in the first query will determine the
column names of the resultset.

SELECT picker AS employee, Field2, Field3
FROM [picking productivity]
UNION ALL
SELECT loader, Field4, Field5
FROM [loading productivity]
--
--Roger Carlson
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L
 
E

EmoryKA

It worked. Thank you very much.

Roger Carlson said:
You can use a UNION query to do this. Something like this:

SELECT picker AS employee
FROM [picking productivity]
UNION ALL
SELECT loader
FROM [loading productivity]

This will get you all the names listed in a column "employee". Presumably
you want other fields. You can add them, but there has to be the same
number of fields in the field list of each query. They don't have to be
named the same. The field names in the first query will determine the
column names of the resultset.

SELECT picker AS employee, Field2, Field3
FROM [picking productivity]
UNION ALL
SELECT loader, Field4, Field5
FROM [loading productivity]
--
--Roger Carlson
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L


EmoryKA said:
I have a database that tracks productivity. I want to take one query
"picking productivity" and link it to another query "loading productivity".
In the "picking productivity" query the employee name is in field [picker],
and in the "loading productivity" query the employee name is in field
[loader].

How can I write a query that will combine these two queries into one with
[picker] and [loader] becoming [employee]?

The goal is to add the productive time spent picking and loading under this
one field [employee].

Thanks for your assistance.
 

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