-
Notifications
You must be signed in to change notification settings - Fork 11k
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
[5.7] Implemented having between #26758
Conversation
On which databases did you test this? Are we sure it works on all supported databases (mssql,mysql,pgsql,sqlite) that way? |
The having clause with the between operator is valid on all databases that Laravel supports. |
@@ -185,6 +185,7 @@ class Builder | |||
'rlike', 'regexp', 'not regexp', | |||
'~', '~*', '!~', '!~*', 'similar to', | |||
'not similar to', 'not ilike', '~~*', '!~~*', | |||
'between', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was for my initial implementation, I'm removing it right now.
@@ -36,6 +36,7 @@ class Grammar extends BaseGrammar | |||
'offset', | |||
'unions', | |||
'lock', | |||
'between', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was for my initial implementation, I'm removing it right now.
Removed, sorry. My mistake. |
Just want to say
Also
There's |
That was my fear. Seems a lot of edge cases to be aware for this feature. I get the feeling this is better left for users who need it and just should use any TL;DR: I'm in favour of removing it. |
It's obvious that you have to use a group by in combination with an having clause, and obviously you must select only fields used in grouping clause, not |
I only mentioned it because the wrong example query made it to laravel news page. |
* We need this to use the operator in a having clause. * On Laravel 5.5, this operator was removed by laravel#22182 * On Laravel 5.7 there is a new havingBetween method that we can use instead laravel#26758
In the past few weeks we needed to do an having between at work.
We found out that Laravel only supports this type of having with a raw clause, so I'm submitting this PR to help anyone that have our needs and do not want to write a raw clause.
It does not affect the way havings are built so it's a non breaking change.
I have included some basic tests.