title: SQL select unique based on value
body: <p>Table:</p>
  
  <pre><code>Name | Value | Prize
  Race1   32      5
  Race1   22      5
  Race1   30      5
  Race2   11      5
  Race2   12      5
  Race2   31      5
  </code></pre>
  
  <p>What I want to query, When I define a <code>Value</code> 20+, The UNIQUE races (Race1, Race2) will be selected to my result, based on whose <code>Value</code> is higher. And prize should be summed.</p>
  
  <p>So when I do metaquery : <code>select sum(Prize) biggestValueUniqueRaces  where value &gt; -20</code>
  I get:</p>
  
  <p>Query returns :</p>
  
  <pre><code>Prize
    10
  </code></pre>
  
  <p>Where it took into consideration these 2 rows : </p>
  
  <pre><code>Name | Value | Prize
  Race1   32      5
  Race2   31      5
  </code></pre>