I have the following table "sales"
date | revenue |
---|---|
2022-06-01(Week 1) | 100 |
2022-06-08(week 2) | 200 |
2022-05-01(week 1) | 800 |
2022-05-08(week 2) | 900 |
and I want to compare sales current week vs the same week last month and get the following result:
date | revenue June | revenue May |
---|---|---|
2022-06-01(Week 1) | 100 | 800 |
2022-06-08(week 2) | 200 | 900 |
2
Answers
Fiddle
Based on given data, following is for
postgresql
–DB fiddle here.