I'm currently working in a sql project using PostgreSQL, now my results look like this:
month | year | sales
----- + ---- + -----
7 | 2019 | 5300
8 | 2019 | 6600
9 | 2019 | 7100
7 | 2020 | 6900
8 | 2020 | 8800
9 | 2020 | 9500
With this code:
select date_part('month', points_reward.created) as mes,
date_part('year', points_reward.created) as ano,
sum(available_points) as "sales"
from points_reward
group by 1,2
I'm trying to create a table that show me the month vs year like this:
| 2019 | 2020
--- + ---- + ----
7 | 5300 | 6900
8 | 6600 | 8800
9 | 7100 | 9500
Thanks in advance for any hint or help and for taking the time to read.