title: Limit query on highest value of attribute
body: <p>I have a model <code>Teststep</code> with these columns and values:</p>
  
  <pre><code>+----------+----------+---------------+----------+
  |   name   | sequence | inner_sequnce | revision |
  +----------+----------+---------------+----------+
  | Step A   |        1 |             1 |        1 |
  | Step B   |        1 |             2 |        1 |
  | Step B-2 |        1 |             2 |        2 |
  | Step C   |        1 |             3 |        1 |
  | Step D   |        2 |             1 |        1 |
  +----------+----------+---------------+----------+
  </code></pre>
  
  <p>Now I want all teststeps with <code>sequence</code> 1 but only with the highest revision. So in this case it would include <code>Step A</code>, <code>Step B-2</code> and <code>Step C</code>.</p>
  
  <p>The query to get the teststeps with the right <code>sequence</code> is easy:</p>
  
  <p><code>Teststep.where(sequence: 1)</code></p>
  
  <p>But how can I make sure only <code>Step B-2</code> is returned and not <code>Step B</code> or both <code>Step B-2</code> and <code>Step B</code>?</p>