Skip to content

Support for GROUP BY #20

@gastongr

Description

@gastongr

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions