This tutorial shows you how to write distinct query in codeigniter. This method is identical to the Adds the “DISTINCT” keyword to a query.
Let’s create a distinct method in codeigniter
$this->db->distinct();
$this->db->get('table');
// Produces: SELECT DISTINCT * FROM table