Welcome Guest, Not a member yet? Register   Sign In
Active records Distinct() Problem
#6

[eluser]idealws[/eluser]
I am not sure if you have found a fix for this or not. I thought I was having the same issue
due to the profiler showing the results returned were 80295 which is the complete count for
the table I was running the query on. When in fact there is only 51 being returned which is the proper number.

However I came to find out it was working properly and the profiler is just reporting the wrong
information.

I am using CI 2.0 however which could have the fix for this issue already in it.

Here is what my code looks like:
Code:
$abbr = array('AA','AE','AP','AS','DC','FM','GU','MH','MP','PR','PW');
$this->db->where_not_in('stateabbr', $abbr);        
$this->db->select('statename, stateabbr');
$this->db->distinct();
$this->db->order_by("stateabbr", "asc");
$query = $this->db->get('postalus');
if ($query->num_rows() >= 1){return $query->result();}else{return '0';};
return NULL;

Best Regards,
Ray


Messages In This Thread
Active records Distinct() Problem - by El Forum - 12-29-2010, 07:00 AM
Active records Distinct() Problem - by El Forum - 12-29-2010, 07:42 AM
Active records Distinct() Problem - by El Forum - 12-29-2010, 08:00 AM
Active records Distinct() Problem - by El Forum - 12-29-2010, 08:24 AM
Active records Distinct() Problem - by El Forum - 01-02-2011, 07:45 AM
Active records Distinct() Problem - by El Forum - 01-23-2011, 11:02 PM



Theme © iAndrew 2016 - Forum software by © MyBB