Welcome Guest, Not a member yet? Register   Sign In
distinct statement
#1

[eluser]jparent[/eluser]
Hi I have this code:

Code:
$this->db->select("'field'");
$this->db->like('username',$user);
$this->db->group_by('field');
$obj = $this->db->get('sometable');
return $obj->result();

I want to know if there is some way to do somethink like:

Code:
$this->db->select("disticnt 'field'");
$this->db->like('username',$user);
$this->db->group_by('field');
$obj = $this->db->get('sometable');
return $obj->result();

because this code give me an error because it puts "select 'distinct' 'field' from..."
and gives me an error like: "'distinct' is not a field"

How I can do that? I think use the group_by can simulate the distinct clause. I don't know certainly.
#2

[eluser]davidbehler[/eluser]
Code:
$this->db->distinct();
#3

[eluser]jparent[/eluser]
thanks! I can't belive I don't see it in the documentation. It was in front my nose! Silly of me!




Theme © iAndrew 2016 - Forum software by © MyBB