title: SQL partition by on date range
body: <p>Assume this is my table:</p>
  
  <pre><code>ID  NUMBER  DATE
  ------------------------
  1   45      2018-01-01
  2   45      2018-01-02
  2   45      2018-01-27
  </code></pre>
  
  <p>I need to separate using partition by and row_number where the difference between one date and another is greater than 5 days. Something like this would be the result of the above example:</p>
  
  <pre><code>ROWNUMBER   ID  NUMBER  DATE
  -----------------------------
  1           1   45      2018-01-01
  2           2   45      2018-01-02
  1           3   45      2018-01-27
  </code></pre>
  
  <p>My actual query is something like this:</p>
  
  <p><code>SELECT ROW_NUMBER() OVER(PARTITION BY NUMBER ODER BY ID DESC) AS ROWNUMBER, ...</code></p>
  
  <p>But as you can notice, it doesn't work for the dates. How can I achieve that?</p>