title: Soccer league table standings with SQL
body: <p>Perhaps a familiar table for many people. A soccer league table. 
  But, in this list there is one mistake, rank 4 and 5, are totally equal, so these teams should not be ranked 4 and 5, but 4 and 4, and then the ranking should continue with 6. </p>
  
  <pre><code>Ranking | Team | Points | Goals difference | Goals scored | Goals against
  1         A      3        4                  4              0
  2         B      3        3                  3              0 
  3         C      3        1                  2              1
  4         D      3        1                  1              0
  5         E      3        1                  1              0
  6         F      1        0                  2              2 
  7         G      1        0                  0              0 
  </code></pre>
  
  <p>I have been trying to improve the MS SQL query that produces this table, by using a Common Table Expression and SELECT ROW_Number, but that never gives me the right result. Does anyone have a better idea? </p>