title: Laravel not executing queries with 'having' clause
body: <p>I have manually built a large query using the various eloquent functions (i.e. $this->newQuery()->join....), but I can't get it to run.</p>
  
  <p>When I call</p>
  
  <pre><code>echo $query-&gt;toSql();
  </code></pre>
  
  <p>It shows me the query. I can copy and paste it into my command line mysql client, and it runs fine, and returns several rows. But when I call</p>
  
  <pre><code>echo $query-&gt;count();
  </code></pre>
  
  <p>or</p>
  
  <pre><code>echo $query-&gt;get()-&gt;count();
  </code></pre>
  
  <p>It's showing 0.</p>
  
  <p>I eventually enabled my mysql general log to see what was happening. I see that as laravel runs, it executes several queries - each has a <code>prepare</code> line in the log, followed by an <code>execute</code> line. But this one doesn't.</p>
  
  <p>It appears that laravel is preparing the statement, but never executing it. Why not?</p>
  
  <p>After much testing, I have identified the line that causes the problem:</p>
  
  <pre><code>$query-&gt;having('book_author_author_id', 'NOT IN', DB::raw('('.implode(',',$author_ids).')'));
  </code></pre>
  
  <p>It appears that queries which contain a 'having' clause are not executed by laravel, instead it pretends to execute them and returns an empty collection. What is going on?</p>