SELECT rows from a table which relate to qualifying ids in another table using CodeIgniter's query builder
$this->db->select('id');
$this->db->from('tasks');
$this->db->where('task_type','MS');
$subQuery = $this->db->get();
$result = $subQuery->result();
$this->db->from($this->tasks . ' as t');
$this->db->join($this->projects . ' as p', 'p.id = t.project_id', 'left');
$this->db->select('t.*,p.project_name');
I want to check the $result array values in following WHERE clause for ms_id value exist in $result or not.
Out For eg.
$this->db->where(array(
't.company_id' => $company_id,
't.user_id' => $user_id,
't.active' => 1,
'p.is_template' => 0,
'p.project_status' => 'active',
't.task_type' => 'TD'
));