CodeIgniter Forums
Pagination with group by return oci_execute(): ORA-00979: not a GROUP BY expression - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: Pagination with group by return oci_execute(): ORA-00979: not a GROUP BY expression (/showthread.php?tid=90641)



Pagination with group by return oci_execute(): ORA-00979: not a GROUP BY expression - just - 04-12-2024


        return $this;

Code:
$this->builder()
            ->select(‘name, address’)
            ->selectSum('TOTAL’)
            ->groupBy(‘name’, ‘address')
            ->limit($limit,  $offset);

        return $this;


Hi, im new to this forum, i tried to make pagination,  everything work without group by.  
can i get some help?

im using 4.4.6 version.


RE: Pagination with group by return oci_execute(): ORA-00979: not a GROUP BY expression - kenjis - 04-12-2024

Check the SQL statement, then you may know something.
https://codeigniter4.github.io/CodeIgniter4/testing/debugging.html#logging-all-sql-queries


RE: Pagination with group by return oci_execute(): ORA-00979: not a GROUP BY expression - just - 04-13-2024

Hi Kenjis, thanks for reply.
i tried to var dump. and show query looks fine.

event good without pagination from models. any specific Hints?


RE: Pagination with group by return oci_execute(): ORA-00979: not a GROUP BY expression - kenjis - 04-13-2024

If you get ORA-00979, the SQL statement is wrong.
So you need to fix the SQL statement.

> event good without pagination from models.

What do you mean?


RE: Pagination with group by return oci_execute(): ORA-00979: not a GROUP BY expression - just - 04-13-2024

(04-12-2024, 06:09 PM)kenjis Wrote: Check the SQL statement, then you may know something.
https://codeigniter4.github.io/CodeIgniter4/testing/debugging.html#logging-all-sql-queries

(04-13-2024, 08:11 PM)kenjis Wrote: If you get ORA-00979, the SQL statement is wrong.
So you need to fix the SQL statement.

> event good without pagination from models.

What do you mean?


i tried, without pagination, and its execute well. no error without ->paginate()
is there other ->groupBy() 
to grouping on builder?

(04-12-2024, 01:31 PM)just Wrote:
        return $this;

Code:
$this->builder()
            ->select(‘name, address’)
            ->selectSum('TOTAL’)
            ->groupBy(‘name’, ‘address')
            ->limit($limit,  $offset);

        return $this;


Hi Kenjis, thanks for pointing me out.
its done by change : 
 
Code:
->groupBy(‘name’, ‘address')

into 
 -
  ->groupBy(‘name,address')



RE: Pagination with group by return oci_execute(): ORA-00979: not a GROUP BY expression - kenjis - 04-13-2024

See https://codeigniter4.github.io/CodeIgniter4/database/query_builder.html#builder-groupby