Skip to content
New issue

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

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

Already on GitHub? # to your account

Fix HAVING clause to join multiple conditions #219

Merged
merged 1 commit into from
Nov 11, 2017

Conversation

knqyf263
Copy link
Contributor

@knqyf263 knqyf263 commented Nov 9, 2017

When having clause has multiple conditions, they are joined by ,.
Then, the following error occurs.

mysql> SELECT * FROM personal GROUP BY id, name HAVING id <>1, length(name) > 5;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' length(name) > 5' at line 1

I think they should be joined by AND or OR.
I support AND for the time being.

mysql> SELECT * FROM personal GROUP BY id, name HAVING id <>1 AND length(name) > 5;
+------+--------+
| id   | name   |
+------+--------+
|    2 | foobar |
+------+--------+
1 row in set (0.00 sec)

@aarondl
Copy link
Member

aarondl commented Nov 11, 2017

Thanks, it's sort of funny we missed this :)

@aarondl aarondl merged commit be6d27f into volatiletech:dev Nov 11, 2017
@knqyf263 knqyf263 deleted the fix_having_clause branch November 12, 2017 01:35
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants