Skip to content

Query Builder count() return wrong number with groupBy() #14123

Closed
@enbaby

Description

@enbaby

sorry, my mistake. solved

My Laravel version info:
Laravel Framework version 5.1.40 (LTS)

See this issue
#4306

In my test,it's still has problem.

dd(Member::groupBy('id')->count());

I only get result 1.


but in this method

dd(Member::count());

I get right num(more than 1)

(the id is primary key, so i should get same result).


And both has problem use sum method after groupBy method,it seems only get the first query result.

dd(Member::groupBy('id')->sum('xxxx'));

IS ANYONE HAS THIS PROBLEM?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions