title: MySQL querying with a dynamic range?
body: <p>Given the table snippet:</p>
  
  <pre><code>id | name | age
  </code></pre>
  
  <p>I am trying to form a query that will return 10 people within a certain age range. However, if there are not enough people in that range, I want to extend the range until I can find 10 people.</p>
  
  <p>For instance, if I only find 5 people in a range of 30-40, I would find 5 others in a 25-45 range.</p>
  
  <p>In addition, I would like the query to be able use order by RAND() or similar, in order to be able to get different results each time.</p>
  
  <p>Is this going beyond what MySQL can handle? Will I have to put some of this logic in the application instead?</p>