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

HAVING is generated before GROUP BY #108

Closed
zbaylin opened this issue Apr 17, 2019 · 0 comments
Closed

HAVING is generated before GROUP BY #108

zbaylin opened this issue Apr 17, 2019 · 0 comments
Labels
Milestone

Comments

@zbaylin
Copy link

zbaylin commented Apr 17, 2019

In a Clear::SQL.select(...).having { x }.group_by { y }, the SQL HAVING is generated before the GROUP BY, which is illegal in postgres.
I.e.

SELECT * FROM users
HAVING count(x) > 10
GROUP BY name

This StackOverflow question describes why it is this way https://stackoverflow.com/questions/27022414/why-does-the-having-clause-need-to-come-after-the-group-by

@anykeyh anykeyh added the bug label Apr 17, 2019
@anykeyh anykeyh added this to the v0.7 milestone Apr 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants