Search code examples
sqlms-accessoledb

"Join expression not supported" for multiple Left Join in MS Access


I have the following query which I am passing as a string in my ASP.NET project:

SELECT creditorName, amount, interestRate, interestType, interestCalculationMethod, insertedDate, o.fullName AS owner, u.fullName AS dataInsertedBy FROM ((tbl_savings s) LEFT JOIN tbl_users o ON (ownerID = o.userID)) LEFT JOIN tbl_users u ON (dataEnteredByID = u.userID);

for which I am getting the following error:

+       $exception  {"Join expression not supported."}  System.Data.OleDb.OleDbException

I am using MS Access 2016 as the database.

What's wrong?


Solution

  • I found the solution on MSDN. Here's the link:

    https://social.msdn.microsoft.com/Forums/office/en-US/15c36745-f7a4-4926-9687-7161e5894468/join-expression-not-supported-error-caused-by-unbracketed-join-expression-comprising-string?forum=accessdev

    I apologize for not putting in the correct answer along with the link that I posted. Here is the correct answer:

    select savingsID, creditorName, amount, interestRate, 
        interestType, interestCalculationMethod, insertedDate,
        ownerID, o.fullName as owner,
        u.fullName as dataEnteredBy
    from (
       (tbl_savings as s)
       left join tbl_users as o on s.ownerID = o.userID
    ) left join tbl_users as u on s.dataEnteredByID = u.userID