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

Complex WHERE and HAVING aggregation condition #496

Merged
merged 1 commit into from Mar 26, 2021

Conversation

hrach
Copy link
Member

@hrach hrach commented Mar 2, 2021

No description provided.

@hrach hrach force-pushed the complex_having_where_aggregation_condition branch from 75f2742 to 67fac62 Compare March 2, 2021 21:10
@hrach hrach linked an issue Mar 2, 2021 that may be closed by this pull request
…se and aggretaion in HAVING

This commit changes how we handle has-many relationship query construciton.
Until now, every has-many relationship was simply left-joined and filtered
via where. The duplication was solved by group-by statement.

From now on, the joined table is filtered already in the JOIN clause and the
where-part is simply aggretation count of the joined table > 0.

This allow moving the where clause to having clause, where it may be
combined with other aggregation filtering condition.
@hrach hrach force-pushed the complex_having_where_aggregation_condition branch from 67fac62 to d52f0c1 Compare March 2, 2021 21:24
@hrach hrach merged commit 880b998 into master Mar 26, 2021
@hrach hrach deleted the complex_having_where_aggregation_condition branch March 26, 2021 22:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Complex HAVING & WHERE queries
1 participant