title: SQL: Combine two count queries into one
body: <p>Currently I have two sql queries with each returning the total count of a certain column for a specific date:</p>
  <pre><code>select first_name COUNT(*) as totalCount from some_table
  where the_date &gt;= '2020-09-14' and the_date &lt;='2020-09-15' 
  group by first_name
  
  select first_name COUNT(*) as totalCount from some_table
  where the_date &gt;= '2020-09-16' and the_date &lt;='2020-09-17' 
  group by first_name
  </code></pre>
  <p>Each will return a table such as:</p>
  <p><code>first_name | totalCount</code></p>
  <p>Instead, I would like one query that returns results as such:</p>
  <p><code>first_name | count1 | count2</code></p>
  <p>With count1 being the total count for the first query and count2 being the total count for the second query</p>
  <p>I tried:</p>
  <pre><code>select first_name COUNT(*) as count1 from some_table
  where the_date &gt;= '2020-09-14' and the_date &lt;='2020-09-15' 
  group by first_name
  UNION
  select first_name COUNT(*) as count2 from some_table
  where the_date &gt;= '2020-09-16' and the_date &lt;='2020-09-17' 
  group by first_name
  </code></pre>
  <p>But it still returned results of count1 only.</p>