Hello Sirs!
It will be a bit difficult to explain. Please have a look at attached file for better understanding.
What I want to achieve is to have results from Table1 summarized in each row. Summary should be between given dates From Table2. Please note that db has dates in YYYYMM format.
I imagine results like this:
1month |2country |SumOf3sales
202101 |CZ |3 (no change as 202012 is not in db)
202101 |PL |2 (no change as 202012 is not in db)
202102 |CZ |8 (5+3)
202102 |PL |6 (4+2)
202103 |CZ |12 (7+5)
202103 |PL |10 (6+4)
202104 |CZ |16 (9 from 202104CZ+7 from 202103CZ)
202104 |PL |14 (8 from 202104PL+6 from 202103PL)
Hopefully you will be able to understand what I'm trying to make
Bookmarks