Welcome Guest, Not a member yet? Register   Sign In
Help on $this->db->distinct() in a model
#1

[eluser]Juan Velandia[/eluser]
Hello people.

I would like to replace this model
Code:
function get_date_status()  
     {
       $this->db->select('date_saldo');
       $this->db->group_by('date_saldo');
       $query = $this->db->get('con_unit_status');
       return $query->result();
       }

For something like

Code:
function get_date_status()  
     {
       $this->db->distinct('date_saldo');
       $query = $this->db->get('con_unit_status');
       return $query->result();
       }

But it doesn't seem to work, any ideas. Thanks in advance!
#2

[eluser]Rok Biderman[/eluser]
The distinct in AR is passed without arguments, so it would look something like this:
Code:
$this->db->distinct();
$this->db->select('oseba');
$query = $this->db->get('postavke');
return $query->result();

If you need further explanation, try and read:

http://ellislab.com/forums/viewthread/157238/

or try this:

http://ellislab.com/forums/viewthread/57781/
#3

[eluser]Juan Velandia[/eluser]
Thanks Coccodrillo! best regards!




Theme © iAndrew 2016 - Forum software by © MyBB