 <p>You could do something like this. You can find more help in the CI docs</p> <pre><code>$this-&gt;db-&gt;select('M.*, p.name as page_name', FALSE); $this-&gt;db-&gt;from('omc_menu as M'); $this-&gt;db-&gt;join('omc_page as P', 'M.page_id = P.id', 'left'); $this-&gt;db-&gt;where('M.parentid', '0', FALSE); $this-&gt;db-&gt;order_by('M.parentid,M.order','ASC'); </code></pre>