Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JOINs should be grouped #449

Open
perdjurner opened this issue Feb 22, 2015 · 1 comment
Open

JOINs should be grouped #449

perdjurner opened this issue Feb 22, 2015 · 1 comment

Comments

@perdjurner
Copy link
Contributor

Consider an HABTM example of customer - subscription - magazine with default setting for joinType. We need to be able to retrieve customers with no subscriptions and magazines with no subscriptions without having to change the joinType to outer.

Therefore the INNER JOIN needs to be grouped in parentheses before LEFT OUTER JOINing to customer or magazine.

Here's a good explanation:
http://www.bennadel.com/blog/1059-grouping-join-clauses-in-sql.htm

Possible implementation:

  • We only need to nest when both inner and outer joins are used (so do a check for that before starting to nest the FROM clause).
  • When joinType is "inner" we need to nest it (in other words subscriptions will, by default, be inner joined to magazines inside parentheses before being left outer joined to customers).
  • We need a test case where there are multiple inner joins nested (the one at the right in the "include" string should be the most deeply nested one).
@dnyaneshwar-rede
Copy link

Hi @bpamiri , I hope you're doing well. I noticed the HABTM issue is still open, and I'd like to take a shot at working on it. Could you please provide any additional guidance or context before I start? Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants