0

I am trying to join multiple tables from an access database. When I join two it works fine, but I need to join 9. Trying to join 3 like so gives the error:

Syntax error (missing operator) in query expression

Here is my command:

OleDbCommand gpInfoCommand = new OleDbCommand("SELECT * FROM GPInformation " +
                                              "LEFT JOIN GPAvailability ON GPInformation.ID=GPAvailability.GPID " +
                                              "LEFT JOIN GPCustomPayRates ON GPInformation.ID=GPCustomPayRates.GPID", connection);
mbdavis
  • 3,562
  • 2
  • 18
  • 36

2 Answers2

1

MS Access requires parentheses around joins when there is more than one. See the examples here: Is it possible to do a 3 table join in MS-Access?

Community
  • 1
  • 1
Erik
  • 5,195
  • 22
  • 36
1

MS Access has an arcane syntax for multiple joins that requires parentheses:

SELECT *
FROM (GPInformation LEFT JOIN
      GPAvailability
      ON GPInformation.ID = GPAvailability.GPID
     ) LEFT JOIN
     GPCustomPayRates
     ON GPInformation.ID = GPCustomPayRates.GPID;
Gordon Linoff
  • 1,198,228
  • 53
  • 572
  • 709