title: SQL Between date column filed not null
body: <p>I would like to count all unique customers that were active on 2019-01-01 with the condition that they also were active in the subsequent 3 days.</p>
  <p>Main table</p>
  <pre><code>date        customer_id   time_spent_online_min
  2019-01-01  1             5
  2019-01-01  2             6
  2019-01-01  3             4
  2019-01-02  1             7
  2019-01-02  2             5
  2019-01-03  3             3
  2019-01-04  1             4
  2019-01-04  2             6
  
  </code></pre>
  <p>Output table</p>
  <pre><code>date         total_active_customers
  2019-01-01   2
  
  </code></pre>
  <p>This is what I have tried so far:</p>
  <pre><code>with cte as(
  
  select customer_id
        ,date
        ,time_spent_online_min
  
  from main_table
  where date between date '2019-01-01' and date '2019-01-04'
  and customer_id is not null)
  
  select    date 
           ,count(distinct(customer_id)) as total_active_customers
  from cte
  where date = date '2019-01-01'
  group by 1
  </code></pre>