Bladephp: Now with 8+ codeigniter, php, and laravel project 8+ php project From $37/Month From Rs. 2499/Month

group_by() Query in Codeigniter

by
Category:codeigniter
codeigniter mysql
group_by() Query in Codeigniter

The SQL GROUP BY clause is used in collaboration with the SELECT statement to arrange identical data into groups. This GROUP BY clause follows the WHERE clause in a SELECT statement and precedes the ORDER BY clause.

Let’s create a group_by method in codeigniter

Permits you to write the GROUP BY portion of your query

$this->db->group_by("userid");
// Produces: GROUP BY userid

You can also pass an array of multiple values as well.

$this->db->group_by(array("userid", "date"));  
// Produces: GROUP BY userid, date

0 Comments


Html code work in comment box


Related Post