Welcome Guest, Not a member yet? Register   Sign In
active record query order
#2

[eluser]skattabrain[/eluser]
ok, it is in order if you are using only where or only like, but if you mix, where is forced first. i guess this makes sense?

i guess i don't undestand if joins merge the tables together first before the where part of the query.

here is my actual query ...

Code:
$this->db->from('parts');
        $this->db->like('parts.PartNumber', $pn, 'after');
        
        if($region_filter != 'all')
        {
            $this->db->where('clients.region', $region_filter);
        }        
        
        $this->db->join('inventory', 'inventory.partID = parts.partID');
        $this->db->join('clients', 'clients.clientID = inventory.clientID');
        
        
        $this->db->order_by('inventory.pnDisp','ASC');
        $this->db->order_by('inventory.type','DESC');
        $this->db->order_by('clients.scAvg','DESC');


Messages In This Thread
active record query order - by El Forum - 05-07-2008, 03:21 PM
active record query order - by El Forum - 05-07-2008, 03:32 PM



Theme © iAndrew 2016 - Forum software by © MyBB