Ranking teams equal on points in a pool based on who won the game they played

后端 未结 3 599
没有蜡笔的小新
没有蜡笔的小新 2021-01-21 02:09

I\'m writing an application that calculates the ranking of teams in the pool stages of a rugby competition (Rugby World Cup 2015, but it could apply to many other pool-based

3条回答
  •  再見小時候
    2021-01-21 02:29

    This is complicated, but I would try the following.

    1. Make a view each combination of opponents and who wins the tie.
    2. With the results of your current ranking add in a column for the prior player, a column for prior rank, a column for next rank using windowing functions
    3. Join to the view in step 1
    4. Make a case statement that only sets a value if prior rank or next rank is equal that has the value from the view in step 1.
    5. Sort by rank and the column in step 4

提交回复
热议问题