rappasoft/laravel-livewire-tables

[Bug]: Cannot use GroupBy or multiple GroupBy and multiple distinct in PostgresSql

mvhamadiqbalriv opened this issue · 1 comments

What happened?

I cannot use the query GroupBy and multiple distinct, that query always throws me error exception.

How to reproduce the bug

I write code like this in Builder function

public function builder(): Builder
{
    $query = JobApplicant::select('job_applicants.*')
        ->groupBy('job_applicants.email');

    return $query;
}

that showing me ERROR like

SQLSTATE[42803]: Grouping error: 7 ERROR: column "job_applicants.id" must appear in the GROUP BY clause or be used in an aggregate function LINE 1: select count(*) as aggregate from (select "job_applicants".*... ^ 

select count(*) as aggregate from (select "job_applicants".*, "job_applicants"."name" as "name", "job_applicants"."email" as "email", "job_applicants"."phone" as "phone", "job_applicants"."gender" as "gender", "job_applicants"."identification_no" as "identification_no", "job_applicants"."degree" as "degree", "job_applicants"."working_experience" as "working_experience", "job_applicants"."expected_salary" as "expected_salary", "job_applicants"."created_at" as "created_at" from "job_applicants" group by "job_applicants"."email") as "aggregate_table"

Package Version

3

PHP Version

8.1.x

Laravel Version

No response

Alpine Version

No response

Theme

None

Notes

How to custom data with groupby or multiple groupby and multiple distinct in builder?

Error Message

No response

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.