I am trying to create a query within a commercial ERP system that uses Access as its database, E2 Shop System. So it just runs the query through Access.
I want the query to tell me "how much time was logged on every machine on a prompted date, even if it is 0". I have figured out how to get it to output how much time is on a machine, but only for a machine that has time on it.
Here is the simplified example:
Table: M(machine)
Name | ID
------------
Saw | 1
Drill | 2
Weld | 3
Lathe | 4
Paint | 5
Table: T(time)
Hours | Date | Name
-------------------------
8 | 10-25 | Weld
6 | 10-25 | Saw
10 | 10-25 | Lathe
2 | 10-01 | Drill
The output I want from the query when prompted for Date 10-25 is to get:
Saw | 6
Drill | 0
Weld | 8
Lathe | 10
Paint | 0
All I can figure out is this, and it limits the output to only machines that have time against them
SELECT M.name, T.time
FROM M, T
WHERE T.Date = [ENTER DATE POSTED (MM/DD/YY):]))
ORDER BY M.ID ;
I'am thinking that CASE could help, but I can't get it to work.