You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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!
The text was updated successfully, but these errors were encountered:
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!
The text was updated successfully, but these errors were encountered: