Graham86
07-04-2008, 01:06 PM
Hi I have two tables (tMachine, tMachineTime) in a query, they are linked so there is a one-to-many link between the tables (tMachine as the one and tMachineTime as Many). In tMachine there is a list of all the machines in the plant; in tMachineTime there is a Date field, Machine field and a hours worked field.
ie.
tMachine
Machine1
Machine2
Machine3
tMachineTime
01/07/2008 Machine1 5
01/07/2008 Machine3 6
02/07/2008 Machine1 4
02/07/2008 Machine2 6
What I want to get in the query is:
Machine1 01/07/2008 5
Machine2 01/07/2008 0
Machine3 01/07/2008 6
Machine1 02/07/2008 4
Machine2 02/07/2008 6
Machine3 02/07/2008 0
So on every date I want to have list of all the machines and how long they have worked for that day, the query is also summing the information in the case that a machine was used twice in one day. I have no way of changing the information in tMachineTime as it is a linked table that is updated by another program.
I have been trying to get a query to give me this information but have been unsuccessful, if the machine is not in the tMachineTime on a specific date it will not show up in the query for that date (unless in a crosstab but i have more information then just hours worked that I need so it does not work). I have been racking my brain to find a way to do this, any and all help is greatly appreciated.
Thanks
ie.
tMachine
Machine1
Machine2
Machine3
tMachineTime
01/07/2008 Machine1 5
01/07/2008 Machine3 6
02/07/2008 Machine1 4
02/07/2008 Machine2 6
What I want to get in the query is:
Machine1 01/07/2008 5
Machine2 01/07/2008 0
Machine3 01/07/2008 6
Machine1 02/07/2008 4
Machine2 02/07/2008 6
Machine3 02/07/2008 0
So on every date I want to have list of all the machines and how long they have worked for that day, the query is also summing the information in the case that a machine was used twice in one day. I have no way of changing the information in tMachineTime as it is a linked table that is updated by another program.
I have been trying to get a query to give me this information but have been unsuccessful, if the machine is not in the tMachineTime on a specific date it will not show up in the query for that date (unless in a crosstab but i have more information then just hours worked that I need so it does not work). I have been racking my brain to find a way to do this, any and all help is greatly appreciated.
Thanks