title: How can I combine COUNT(*) for two different ActiveRecord relations into a single SQL query?
body: <p>With two different ActiveRecord relation objects, is there a way to issue one SQL query to compare the counts of the relations?</p>
  
  <p>eg. say I have two ActiveRecord::Relation objects like this:</p>
  
  <pre class="lang-rb prettyprint-override"><code>posts = Post.where().where().some_scope
  users = User.where().some_other_scope.where().joins(:something)
  </code></pre>
  
  <p>To compare the counts of each relation, I'd have to issue two SQL queries.</p>
  
  <pre><code>posts.count == users.count
  # =&gt; SELECT COUNT(*) FROM posts WHERE... ;
  # =&gt; SELECT COUNT(*) FROM users INNER JOIN ... WHERE... ;
  </code></pre>
  
  <p>I want to be able to issue just one query. Something like:</p>
  
  <pre><code>Post.select("COUNT(first) == COUNT(second) as are_equal"), posts, users).are_equal
  </code></pre>