Hello,
Please refer to the attached file.
I have five tables of the five three are related by primary key tblA, tblAB, tblB I can list elements in these tables through the following query which I name qryA_AB_B:
SELECT tblA.ID_A
, tblA.Attr01_A
, tblA.Attr02_A
, qryMain.ID_B
, qryMain.Attr01_B
, qryMain.Attr02_B
FROM tblA LEFT JOIN (
SELECT tblAB.ID_A
, tblAB.ID_B
, tblB.Attr01_B
, tblB.Attr02_B FROM tblAB INNER JOIN tblB
ON tblB.ID_B = tblAB.ID_B) AS qryMain
ON tblA.ID_A = qryMain.ID_A
ORDER BY 1, 4;
However tblA has attributes in tables tblA01 and tblA02 which I should easily retrieve by adding
RIGHT JOIN (tblA02 RIGHT JOIN qryA_AB_B
ON [tblA02].A02_ID = [qryA_AB_B].Attr02_A)
ON [tblA01].A01_ID = [qryA_AB_B].Attr01_A;
To the above query so the full query looks like:
SELECT ID_A
, Attr01_A
, Attr02_A
, ID_B
, Attr01_B
, Attr02_B
FROM qryA_AB_B
RIGHT JOIN (tblA02 RIGHT JOIN qryA_AB_B
ON [tblA02].A02_ID = [qryA_AB_B].Attr02_A)
ON [tblA01].A01_ID = [qryA_AB_B].Attr01_A;
but Access would not save the query which I name qryFinal and keep telling me syntax error on JOIN [tblA01].A01_ID.
Anybody sees anything wrong here.