I think this should be easy, but it\'s evading me. I\'ve got a many-to-many relationship between Accounts and Account Groups. An Account can be in zero or more Groups, so I\
I think in Access you may want to try something like:
FROM (accounts AS act
LEFT OUTER JOIN JointAccountGroups AS jag ON act.id = jag.aid)
LEFT OUTER JOIN AccounGroups AS gp ON jag.gid = gp.id
I don't know why the parenthesis matter, but I tried a test with that and it seemed to fix it.
Another Try:
SELECT act.acctid AS AcctId, bankName, acctNumber, Balance,
jag.gid AS GroupID, gp.groupname AS GroupName
FROM accounts AS act
LEFT OUTER JOIN JointAccountGroups AS jag ON act.id = jag.aid
LEFT INNER JOIN AccounGroups AS gp ON jag.gid = gp.id
Access might be having trouble with the two OUTER JOINS so I made the second one an INNER JOIN which should work
Not only use the query designer as suggested earlier, but also use the MS Access relationship tool to record the relationship between the two foreign keys (AID, GID) and the primary keys they reference.
This makes doing natural joins in the query designer almost child's play. You can even use a query wizard in the situation you outlined.
Once you have the query built, why not use the query as a record source instead of using the tables?
The one thing I would do in PHP would be converting the multiple results into a comma separated list.