Reputation: 14236
I am new for codeigniter
and problem in Active Record(JOIN).
SELECT emp.name
,emp_detail.salary
FROM emp
INNER JOIN emp_details ON emp.id=emp_details.eid
AND emp_detail.salary > 5000
How to change above query in codeigniter
.
Upvotes: 2
Views: 2060
Reputation: 21437
You had typo within your query. I have updated yours into Active Records. This'll work for you..
$this->db->select('e.name,ed.salary');
$this->db->from('emp e');
$this->db->join('emp_details ed','e.id = ed.eid');
$this->db->where('ed.salary > 5000');
$result = $this->db->get()->result_array();
print_r($result);
Upvotes: 6