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.


Messages In This Thread
distinct statement - by El Forum - 11-02-2009, 05:53 AM
distinct statement - by El Forum - 11-02-2009, 05:58 AM
distinct statement - by El Forum - 11-02-2009, 06:12 AM



Theme © iAndrew 2016 - Forum software by © MyBB