Problems with more than 1 left connection in MSAccess

This is related to my previous question. More than 1 left connection in MSAccess.

The problem is that I have 3 left connections, followed by an operator ANDto check 1 condition.

If I run, then I get the error message "Joining is not supported."

The request is as follows:

SELECT * FROM(( EMPLOYEE AS E  LEFT JOIN DEPARTMENT AS D ON E.EID=D.EID)
                 LEFT JOIN MANAGERS M ON D.DID=M.DID)
             LEFT JOIN MANAGERDETAILS MD  ON M.MDID=MD.MDID
 **AND E.ENO=MD.ENO**

If I output the part AND, it works fine.

Any idea?

+3
source share
3 answers

How would I write it:

SELECT EDM.*, MANAGERDETAILS.*
FROM (
    SELECT ED.*, MANAGERS.*
    FROM (
        SELECT EMPLOYEE.*, DEPARTMENT.*
        FROM EMPLOYEE
        LEFT JOIN DEPARTMENT
        ON EMPLOYEE.EID = DEPARTMENT.EID
    ) AS ED
    LEFT JOIN MANAGERS
    ON ED.DID = MANAGERS.DID
) AS EDM
LEFT JOIN MANAGERDETAILS
ON EDM.MDID = MANAGERDETAILS.MDID
    AND EDM.ENO = MANAGERDETAILS.ENO

Basically, you join the tables one at a time and get a result that you can then use for the next join.

Access . , , , , , .

+4

ON, - MANAGERDETAILS.

, sql, AND ON ( E.EID = D.EID), , current ON, MANAGERDETAILS.

0

Employee, .

SELECT * FROM (((EMPLOYEE AS ​​E LEFT JOIN DEPARTMENT AS D ON E.EID = D.EID) LEFT JOINING MANAGERS AS M ON D.DID = M.DID) LEFT JOIN MANAGERDETAILS AS MD ON M.DID = MD.MDID) LEFT JOIN EMPLOYEE AS ​​E2 ON MD.ENO = E2.ENO;

We do not have enough information about the data that you expect, but this request will be completed.

I know that in Access you will need to handle parentheses, but you can do this using the graphical query builder.

0
source

Source: https://habr.com/ru/post/1711478/


All Articles