"Joining" multiple queries

J

JMK

Hi All,

This is simple, and I know I have found the answer myself in the past
through trial and error but after days of searching the answer is no closer
to me - and I know it is such a SIMPLE fix...

At any rate, I have a set of queries which calculate employee hours worked
over the past 7 days in different positions. An employee can work in any one
of four positions, but never more than one at a time. The queries are set to
identify how much time is spent in each position.

For example

ID POS1 POS2 POS3 POS4
123 1 52 157 198
..
..
129 52 39 1 157
130 2 29 36 22

Where ID 123 = 2.2 Hours
129 = 1.3 Hours
130 = 4.5 Hours

and 1, 52, 157, etc equal employee ID Numbers.

Employee 1 worked 2.2 hours in position 1 and 1.3 hours in Position 3.

What I need is a query which will combine the hours worked for all employees
(i.e giving a figure of 3.5 hours for employee 1).
The problem is the query I have ignores those employees who only work one
position or when I try to set it up so it will add everything, it ignores all
the data.

What is the way around this? For the life of me I cannot remember how I did
this before, and unfortunately the database it was in is long gone!!!
 
L

Lord Kelvan

you may want to change the join type of the query to a left join from
an inner join

Hope this helps
Regards
Kelvan
 
J

JMK

Thank-you! I actually ended up using a suggestion from another one of your
posts on Union Queries (only because it gave me an excuse to start
programming in SQL) but the left join worked just as well! Thanks again and
much appreciated.
 

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