Welcome Guest, Not a member yet? Register   Sign In
Compare data from two different tables using codeigniter
#1

[eluser]Unknown[/eluser]
I am new to codeigniter and I want to write this mySql query
Code:
SELECT COUNT(DISTINCT source) AS NumberOfEvaluations
FROM COMMENT , EVALUATION
WHERE evaluation_id = EVALUATION.id AND EVALUATION.department_id = '$department_id' ;

into codeigniter.
This is my try

Code:
$this->db->select('t1.count(DISTINCT(source))');  
   $this->db->from('comment t1');
   $this->db->join('evaluation t2', 't2.id = t1.evaluation_id', 'left');    

   $this->db->where();
  
$query=$this->db->get();  
   return $query->num_rows();


Messages In This Thread
Compare data from two different tables using codeigniter - by El Forum - 05-23-2013, 01:05 PM



Theme © iAndrew 2016 - Forum software by © MyBB