title: Multiple (left, cross?) JOINs in MS Access
body: <p>I've got a following MS access (2010) database:</p>
  
  <p><img src="https://i.stack.imgur.com/s37as.png" alt="database diagram"></p>
  
  <p>Employee, Period and Operation tables are populated, and UnitOfWork table is blank. </p>
  
  <p>Basically I am having some items being produced by multiple workers (employees). Each item requires multiple operations (each worker can do any operations of any item any amount of times). All operations have some cost, and I will need to generate reports of how much every employee have earned "this month", have he fulfilled the plan, etc.</p>
  
  <p>I want to do a SELECT to see following: UnitOfWorks, for every available combination of Employee, Period and Operation.</p>
  
  <p>In other words, <strong>I want to SELECT all possible combinations of Employee, Period and Operation and LEFT JOIN UnitOfWork to the result, so I can input OperationsDone for every UnitOfWork</strong>. I'll add WHERE clauses and ORDER and later</p>
  
  <p>I thought CROSS JOIN would help (In MS Access it is just enumeration with commas), something like this:</p>
  
  <pre><code>SELECT * FROM (Employee, Period, Operation)
  LEFT JOIN UnitOfWork on UnitOfWork.OperationId=Operation.OperationId
  </code></pre>
  
  <p>But when I execute this query, I get a "Syntax error in JOIN operation" error.</p>
  
  <p>I've also tried like this:</p>
  
  <pre><code>SELECT * FROM Employee AS e LEFT JOIN
  (Period AS p LEFT JOIN UnitOfWork AS uow ON p.PeriodId=uow.PeriodId)
  on e.EmployeeId=uow.EmployeeId
  </code></pre>
  
  <p>These are only 2 joins out of 3 I need, but already with this I get "JOIN Expression not supported" error.</p>
  
  <p>Any database design suggestions are also appreciated - this is a new database I'm designing and I'm a SQL newbie.</p>
  
  <p>Thanks in advance!</p>
  
  <p>Update:
  I am also thinking, maybe I should try a subquery? Like doing a CROSS join (of Operation, Employee and Period) in one query, and then LEFT joining the UnitOfWork to the query result... but how do I do a JOIN "by multiple fields"? And how do I implement a subquery in access?</p>