Here's an MS Access query that returns data:
SELECT Invoices.ID, Invoices.DateGenerated, Timesheet.ActivityDate, Timesheet.ActivityDescription,
Timesheet.Hours, Rate.GstExcRate, Rate.GSTRate, Timesheet.Hours * Rate.GstExcRate AS BilledGSTExc,
Timesheet.Hours * Rate.GstRate AS BilledGST
FROM
(Invoices INNER JOIN Timesheet ON Invoices.ID = Timesheet.InvoiceID)
INNER JOIN Rate
ON (Timesheet.ActivityDate >= Rate.DateFrom) AND (Timesheet.ActivityDate <= Rate.DateTo);
I need to add another table so I add another INNER JOIN to this:
SELECT Invoices.ID, Invoices.DateGenerated, Timesheet.ActivityDate, Timesheet.ActivityDescription,
Timesheet.Hours, Rate.GstExcRate, Rate.GSTRate, Timesheet.Hours * Rate.GstExcRate AS BilledGSTExc,
Timesheet.Hours * Rate.GstRate AS BilledGST
FROM
(Invoices INNER JOIN Timesheet ON Invoices.ID = Timesheet.InvoiceID)
INNER JOIN Rate
ON (Timesheet.ActivityDate >= Rate.DateFrom) AND (Timesheet.ActivityDate <= Rate.DateTo)
INNER JOIN Periods
ON (Periods.ID = Invoices.PeriodID);
but I get
Syntax error (missing operator) in query expression '(Timesheet.ActivityDate >= Rate.DateFrom) AND (Timesheet.ActivityDate <= Rate.DateTo) INNER JOIN Periods ON (Periods.ID = Invoices.PeriodID
Clearly there is some specific MS Access syntax required here. Reading I've done implies that INNER JOINS need to be 'nested' but official doco says it's optional.
I've rearranged it in various ways but I can't crack it.
Can anyone tell me is wrong with this syntax (it's perfectly valid in every other SQL dialect that I've used)