Q:

Convert query to codeigniter

I am working in codeigniter.  I want to know, how to write below code in codeigniter..
SELECT p.* FROM people p WHERE p.age = (select max(subp.age) from people subp);

A:

This will work
$this->db->select('p.*'); 
$this->db->from('people p');
$this->db->where('p.age = (select max(subp.age) from people subp)',null,false);
$result = $this->db->get()->result_array();
print_r($result);

