title: Getting distinct count from two segments
body: <p>What I'm trying to achieve:</p>
  
  <p>The DB is postgres. We store users orders with a date of the purchase, and the <code>user_id</code>. I want to get the count of users who ordered this period AND last period (say it's a week, then it's people who ordered this week and last week).</p>
  
  <p>I'm new to SQL and able to get the user count for this week, but that is where it stops.</p>
  
  <pre><code>SELECT
      COUNT(distinct(user_id))
  FROM
      orders
  WHERE
      shipment_state = 'shipped' AND
      delivery_date &gt;= '2017-11-01' AND
      delivery_date &lt;= '2017-11-10'
  </code></pre>
  
  <p>How do I now make it so that it gets the count of those who ordered in that period, but also f.ex the week before the 1st of November?</p>