title: Codeigniter join() not working
body: <p>I am trying to run a query using the codeigniter framework. I want to avoid using the WHERE clause, and instead have included the condition as part of the ON clause in the JOIN statement of the query. This would be far more efficient since the JOIN statement is executed before the WHERE clause. Here is my code:</p>
  
  <pre><code>    $this-&gt;db-&gt;select('SQL_CALC_FOUND_ROWS
          projects.id, projects.project_name, projects.date_modified, 
          projects.last_modifier, projects.status, project_users.permission', false)-&gt;
              from('projects');
          $this-&gt;db-&gt;join('project_users', 'project_users.id = projects.id AND 
              project_users.user_id = ' . $this-&gt;user_id);
      if ($orderby !== false) {
          $this-&gt;db-&gt;order_by($orderby, $direction);
      }
      if ($limit !== null) {
          $this-&gt;db-&gt;limit($limit, $offset);
      }
      $query = $this-&gt;db-&gt;get();
  </code></pre>
  
  <p>When I attempt to load the page, I receive an SQL error. It seems that codeigniter is not including condition after the AND:</p>
  
  <pre><code>SELECT SQL_CALC_FOUND_ROWS projects.id, projects.project_name, projects.date_modified, projects.last_modifier, projects.status, project_users.permission FROM (`projects`) JOIN `project_users` ON `project_users`.`id` = `projects`.`id` AND ORDER BY `project_name` ASC LIMIT 5, 0
  </code></pre>