title: MYSQL get all the results of a date less than given value
body: <p>I have a table as below</p>
  <pre><code>Eid  joinDate
  
  1    01-01-2016
  2    01-01-2016
  3    28-02-2016
  4    28-02-2016
  5    28-02-2016
  6    15-02-2016
  7    15-02-2016
  </code></pre>
  <p>I want to get all the results of a most recent date which has data.</p>
  <p>ex: if I give '<strong>28-02-2016</strong>' as input, then the results should be</p>
  <pre><code>3    28-02-2016
  4    28-02-2016
  5    28-02-2016
  </code></pre>
  <p>If I give '<strong>18-02-2016</strong>' as input the results should be</p>
  <pre><code>1    15-02-2016
  2    15-02-2016(Most recent from 18-02-2016)
  </code></pre>
  <p>I tried with the below query, but it is returning only one result.</p>
  <pre><code>select Eid,max(joinDate) from Employee where joinDate&lt;='18-02-2016' 
  </code></pre>
  <p>But this query is not returning all the results. Also if I use group by then it will return all results less than 18-02-2016</p>
  <p>Is there any other way to achieve this, please suggest.</p>