• OK. #1 and #2 and almost the same thing. Let's start with #1 (Total Cents for each day in the month of March 2013. Revenue is measured with the "cents" field.)

    Do you want to show every day even if there are no rows for that day? Or do you only want to show days when there are rows? The answer to this will change the landscape of these two queries.

    #3 is pretty straight forward (User ID of the user who spent the most Cents in December 2012)

    I would use a cte (common table expression) to first get the total spent for each UserID. Then select the one with the largest total spent.

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/