title: How do I get top N distinct rows from a table with several repeated values?
body: <p>I have the following table on Microsoft SQL server:</p>
  
  <pre><code>NumContr  SeqYear check
  111111111   1   -0.50
  111111111   2   -0.30
  111111111   3    0.30
  111111111   4    0.00
  111111111   5   -40.00
  111111111   6   -200.00
  111111111   7   -100.00
  111111111   8   -0.50
  111111111   9   -0.30
  111111111   10   0.30
  111111111   11   0.00
  111111111   12  -40.00
  111111111   13  -200.00
  111111111   14  -100.00
  400247129   1    NULL
  400247129   2    NULL
  400247129   3    NULL
  400247129   4    NULL
  400247129   5    NULL
  400247129   6    NULL
  400247129   7    NULL
  400247129   8    0.00
  400247129   9    15254.05
  400247129   10   15254.05
  400247129   11   15254.05
  400247129   12   0.00
  400247129   13   0.00
  400247129   14   0.00
  </code></pre>
  
  <p>I would like to have the top 7 <code>SeqYears</code> from each <code>NumContr</code> row. Is there any clean away to achieve this result set?</p>
  
  <p>The table name is tb_FinancialPosition</p>
  
  <pre><code>    111111111   8   -0.50
      111111111   9   -0.30
      111111111   10  0.30
      111111111   11  0.00
      111111111   12  -40.00
      111111111   13  -200.00
      111111111   14  -100.00
      400247129   8   0.00
      400247129   9   15254.05
      400247129   10  15254.05
      400247129   11  15254.05
      400247129   12  0.00
      400247129   13  0.00
      400247129   14  0.00
  </code></pre>
  
  <p>Thanks in advance!</p>