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
.
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);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.