title: How can i include previous row in a selected range if condition is not satisfied
body: <p>I am trying to find out a maximum number from a given date ranges.</p>
  
  <p>for example, my table contains</p>
  
  <pre><code>   date         number
  ----------     --------
  01-01-2019         1
  05-01-2019         3
  07-01-2019         2
  10-01-2019         1
  11-01-2019         2
  </code></pre>
  
  <p>and I want to find the max number in date from <strong>06-01-2019</strong> to <strong>11-01-2019</strong> </p>
  
  <p>When I use the query,</p>
  
  <pre><code>select max(count) from TABLE where date between startDate and endDate;
  </code></pre>
  
  <p>the output is 2.</p>
  
  <p>But what I wanted is if the startDate is not in the table, to include the previous row. For example in the previous case, I want to include the row <strong>05-01-2019</strong> and thus the output should be 3.</p>
  
  <p>Is there any query for this process or do I need to write an algorithm?</p>
  
  <p>Assume the dates in table are sorted and I use a MySQL database.</p>