title: Finding first order in a single year
body: <p>I'm trying to determine how many new people made an order in 2018. This looks straight forward enough but there is an error with putting calculated fields in the WHERE statement.</p>
  <pre><code>SELECT DISTINCT COUNT(c.customer_id)
  FROM Customer c
  LEFT JOIN
      Orders o ON c.customer_id=o.customer_id
  WHERE MIN(order_date) &gt; '2017-12-31'
  AND MIN(order_date) &lt; '2019-01-01';
  </code></pre>