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

Support for GROUP BY #20

Open
gastongr opened this issue Apr 6, 2016 · 0 comments
Open

Support for GROUP BY #20

gastongr opened this issue Apr 6, 2016 · 0 comments

Comments

@gastongr
Copy link

gastongr commented Apr 6, 2016

Hello, first of all thanks for the great library Zepernick, it's perfectly implemented and allows very clean and DRY code!!

Just wanted to ask if you have an idea on how to use GROUP BY with the library?
When using an aggregate function, like SUM(), in select statements, MySQL requieres a GROUP BY clause otherwise it will aggregate the entire table instead of returning one row for each entry.

So i'm using appendToSelect like this in my model:
public function appendToSelectStr() { return array( 'stock' => 'SUM(st.stock)' ); }

But don't know where to add the GROUP BY clause. Any help is appreciated!

Thanks again!

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

No branches or pull requests

1 participant