i want to write this query on codeigniter way. the query is:
S开发者_Python百科ELECT M. * , P.name as page_name
FROM omc_menu AS M
LEFT JOIN omc_page AS P ON M.page_id = P.id
WHERE M.parentid ='0'
ORDER BY `M`.`parentid`,`M`.`order` ASC
You could do something like this. You can find more help in the CI docs
$this->db->select('M.*, p.name as page_name', FALSE);
$this->db->from('omc_menu as M');
$this->db->join('omc_page as P', 'M.page_id = P.id', 'left');
$this->db->where('M.parentid', '0', FALSE);
$this->db->order_by('M.parentid,M.order','ASC');
精彩评论