By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
4 rows affected
| id | ref | v_id | total | year | total_lastyear | lastyear |
|---|---|---|---|---|---|---|
| 1 | 2077 | 15 | 10000 | 2020 | 9000 | 2019 |
| 2 | 2000 | 13 | 190000 | 2020 | 189000 | 2019 |
| 3 | 2065 | 11 | 10000 | 2020 | 10000 | 2019 |
| 4 | 1999 | 14 | 2300 | 2020 | 9000 | 2019 |
| ref | v_id | 2019 | 2020 |
|---|---|---|---|
| 1999 | 14 | null | 2300 |
| 2000 | 13 | null | 190000 |
| 2065 | 11 | null | 10000 |
| 2077 | 15 | null | 10000 |