I need to translate the following MySQL query to a CodeIgniter active record script.
SELECT *
FROM cdr
WHERE (
Circle LIKE '%D%'
OR CLI LIKE '%D%'
OR Operator LIKE '%D%'
)
AND Dept = 'Sale'
I just want it like $this->db->like('Circle','%D%')
with the Dept comparison combined with 'AND'.
You should read the codeigniter doc, it's an easy one :
$this->db->where("(Circle LIKE '%D%' OR CLI LIKE '%D%' OR Operator LIKE '%D%')")
->where("dept", "Sale");
$query = $this->db->get("cdr");
http://www.codeigniter.com/user_guide/database/active_record.html