By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
9 rows affected
| id | date | position | name | previous_positions | med_20 |
|---|---|---|---|---|---|
| 1 | 2016-06-29 00:00:00 | 9 | Ben Smith | null | null |
| 2 | 2016-06-29 00:00:00 | 1 | Ben Smith | {9} | 9.0000000000000000 |
| 3 | 2016-06-29 00:00:00 | 5 | Ben Smith | {9,1} | 5.0000000000000000 |
| 4 | 2016-06-29 00:00:00 | 6 | Ben Smith | {9,1,5} | 5.0000000000000000 |
| 5 | 2016-06-30 00:00:00 | 2 | Ben Smith | {9,1,5,6} | 5.5000000000000000 |
| 6 | 2016-06-30 00:00:00 | 2 | Tom Brown | null | null |
| 7 | 2016-06-29 00:00:00 | 4 | Tom Brown | {2} | 2.0000000000000000 |
| 8 | 2016-06-30 00:00:00 | 2 | Tom Brown | {2,4} | 3.0000000000000000 |
| 9 | 2016-06-30 00:00:00 | 1 | Tom Brown | {2,4,2} | 2.0000000000000000 |