Welcome Guest, Not a member yet? Register   Sign In
Active Records
#1

[eluser]RobertB.[/eluser]
Hello guys,
How can I do this operation with active records.
Code:
WHERE b.cat_id = 2 OR b.state_id IS NULL
Just in case, this is how I'll like to use it.
Code:
$this->db->select('s.id, s.state, COUNT(b.is_active) AS active');
$this->db->from('states AS s');
$this->db->join('businesses AS b', 's.id = b.state_id', 'left');
$this->db->where('b.cat_id', $this->uri->segment(3), 'b.state_id', null);
$this->db->groupby('s.id')

Thanks,
Robert.


Messages In This Thread
Active Records - by El Forum - 03-04-2010, 08:13 PM
Active Records - by El Forum - 03-05-2010, 02:42 AM
Active Records - by El Forum - 03-05-2010, 02:56 AM
Active Records - by El Forum - 03-05-2010, 07:45 AM
Active Records - by El Forum - 03-05-2010, 09:07 AM
Active Records - by El Forum - 03-05-2010, 01:13 PM



Theme © iAndrew 2016 - Forum software by © MyBB