basic many-to-many sql select query

后端 未结 9 1927
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-17 03:06

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\

9条回答
  •  抹茶落季
    2021-01-17 03:52

    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.

提交回复
热议问题