title: codeigniter active record left join
body: <p>I have 3 mysql tables.  </p>
  
  <pre><code>Table 1 user  
  id | name  
  
  Table 2 emails  
  id | email  
  
  Table 3 user_email  
  user_id | email_id  
  </code></pre>
  
  <p>I have no experience in query multi tables.<br>
  Using codeigniter active record, i want to find out the user email address based on the user id, pls advise if the below code is correct ?  </p>
  
  <pre><code>$CI-&gt;db-&gt;select('email');
  $CI-&gt;db-&gt;from('emails');
  $CI-&gt;db-&gt;where('id', $userid);
  $CI-&gt;db-&gt;join('user_email', 'user_email.user_id = emails.id', 'left');
  $query = $CI-&gt;db-&gt;get();  
  </code></pre>