title: How to join a number with the range of number from another table
body: <p>I have the two following tables:</p>
  <pre class="lang-none prettyprint-override"><code>| ID  | Count |
  | --- | ----- |
  | 1   | 45    |
  | 2   | 5     |
  | 3   | 120   |
  | 4   | 87    |
  | 5   | 60    |
  | 6   | 200   |
  | 7   | 31    |
  </code></pre>
  <pre class="lang-none prettyprint-override"><code>| SizeName | LowerLimit | UpperLimit |
  | -------- | ---------- | ---------- |
  | Small    | 0          | 49         |
  | Medium   | 50         | 99         |
  | Large    | 100        | 250        |
  </code></pre>
  <p>Basically, one table specifies an unknown number of range names and their associated integer ranges. So a count range of 0 to 49 from the person table gets a <code>small</code> designation. 50-99 gets '<code>medium</code>' etc. I need it to be dynamic because I do not know the range names or integer values.</p>
  <p>Can I do this in a single query or would I have to write a separate function to loop through the possibilities?</p>