-
Notifications
You must be signed in to change notification settings - Fork 29
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
Support SUM and AVG/MAX/MIN #50
Comments
I think this would be useful, too. I currently have to write manual queries when I decide to do this sort-of thing. A pattern that has worked fairly well with MongoDB has been the distinction between a Theoretically, the query class could eventually turn into a wrapper for the core class that creates clauses. I sort-of started that process in this PR, but I'm not convinced what I did should even be in the |
Some more good news - it appears that BerlinDB already has support for <?php
$query = new Query(['groupby' => 'column_name', 'fields' => 'column_name']);
var_dump($query->items);
?> The above would yield an array of all unique values in the This will most-likely work similar to how |
For anyone interested, I actually built a library (class) for this here: https://github.com/arraypress/edd-extended-query Syntax is like this:
It adds aggregate functionality by hijacking the COUNT queries to perform different operations in a single query. GROUPBY queries are also supported and work as expected. Class can be used with any BerlinDB project. |
This might be off the mark with BerlinDB direction, but It would be useful to have the ability to "SUM" specific columns in the database tables without having to write custom queries as a fallback. Having the ability to use AVG/MAX/MIN would also be beneficial in a lot of use cases.
The text was updated successfully, but these errors were encountered: