Original query:
SELECT *
FROM AA
FULL OUTERJOIN BB on (AA.C_ID = BB.C_ID);
How do I convert the query above to make it compatible in Microsoft Access?
I am assuming:
SELECT *
FROM AA
FULL LEFT JOIN BB ON (AA.C_ID = BB.C_ID);
I haven't dealt with the "FULL" criteria before am I correctly converting the first query into a query compatible with Access?
I found that if the field names are the same in both tables they will need to be listed individually rather than using the * operator. Also, the second SELECT statement needs to reference the other table. Simply using the same SQL as the first and changing it to a RIGHT JOIN does not allow the inclusion of the rows in the BB table.
The more eficient and faster code:
Assuming there are not duplicate rows in AA and BB (i.e. all the same values), a full outer join is the equivalent of the union of a left join and a right join.
If there are duplicate rows (and you want to keep them), add
WHERE AA.C_ID IS NULL
at the end, or some other field that is only null if there is not corresponding record from AA.EDIT:
See a similar approach here.
It recommends the more verbose, but more performant
However, this assumes that
AA.C_ID
andBB.C_ID
are not null.