- I want to show every day, even if there isn't a row for it.
- Don't have much experience with CTE ... the syntax should be something like
WITH <TABLE NAME> (COL1, COL2, ...., COLN)
AS
(<SELECT_QUERY>)
From my understanding of CTE and your explanation the idea would be to create a temporary table in which the revenue spend for each userID would display, and then from that temporary table select the user who spent the most.
WITH UserSpend_CTE (userID, Revenue_Spend)
AS
(SELECT UserID, sum(cents) FROM DollarTransactions)
SELECT [????]
The ???? represents that I don't know the syntax for selecting the userID with highest cents spent.