By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
purchaseDate | customerID | salesUnit |
---|---|---|
2018-01-01 | 1 | 10 |
2018-01-02 | 1 | 5 |
2018-01-05 | 2 | 3 |
2018-01-15 | 1 | 10 |
2018-01-20 | 2 | 4 |
purchaseDate | CustomerID | SalesUnit | SalesLast7 | SalesLast14 |
---|---|---|---|---|
2018-01-01 | 1 | 10 | 10 | 10 |
2018-01-02 | 1 | 5 | 15 | 15 |
2018-01-05 | 2 | 3 | 3 | 3 |
2018-01-15 | 1 | 10 | 10 | 15 |
2018-01-20 | 2 | 4 | 4 | 4 |
Warning: Null value is eliminated by an aggregate or other SET operation.