365 Days of Daily Challenge: Day 84
Today was an ok day. I was I think 65% productive. I could have used my personal time to read instead of using social media. Tiktok, gwad!, they are so addictive. They keep you hooked and you lose your sense of time. An hour or two passes just like that. My sister was absolutely right. She said if you have few hour to waste, that is when you use tiktok.
I solved an easy challenge today.
SELECT *, SUM(daily_spend) OVER (PARTITION BY customer_id ORDER BY date) AS cumulative_spend
FROM(
SELECT DATE(payment_ts) AS date, customer_id, SUM(amount) AS daily_spend
FROM payment
WHERE customer_id in (1, 2, 3)
GROUP BY date, customer_id
ORDER BY customer_id, date) AS k;

Leave a comment