If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
"Joining" multiple queries
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!!! |
#2
|
|||
|
|||
"Joining" multiple queries
you may want to change the join type of the query to a left join from
an inner join Hope this helps Regards Kelvan |
#3
|
|||
|
|||
"Joining" multiple queries
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. "Lord Kelvan" wrote: you may want to change the join type of the query to a left join from an inner join Hope this helps Regards Kelvan |
#4
|
|||
|
|||
"Joining" multiple queries
no problem
|
Thread Tools | |
Display Modes | |
|
|