title: Error when using SQL_CALC_FOUND_ROWS()
body: <p>I'm doing a simple MySQL query to count the number of rows a query is returning without the effect of the <code>LIMIT</code> clause. I'm using Active Records with Codeigniter PHP framework.</p>
  
  <p><strong>Problem:</strong> I'm getting an error when <code>SQL_CALC_FOUND_ROWS</code> is used. Why is this so?</p>
  
  <p><strong>Query</strong></p>
  
  <pre><code>SELECT `listing_id`, SQL_CALC_FOUND_ROWS listing_id FROM (`listings`) LIMIT 100
  </code></pre>
  
  <p><strong>Error</strong></p>
  
  <blockquote>
    <p>You have an error in your SQL syntax; check the manual that
    corresponds to your MySQL server version for the right syntax to use
    near 'SQL_CALC_FOUND_ROWS listing_id FROM (<code>listings</code>) LIMIT 100' at
    line 1</p>
  </blockquote>
  
  <p><strong>Codeigniter Active Records</strong></p>
  
  <pre><code>$this-&gt;db-&gt;select('listing_id')
              -&gt;select('SQL_CALC_FOUND_ROWS listing_id', FALSE)
              -&gt;from('listings')
              -&gt;where('price &lt; 1000')
              -&gt;limit($limit, $offset)
              -&gt;order_by('listing_id', 'desc');
  </code></pre>