Using SQL 2014, creating a stored procedure to feed an SSRS report. Within it I am using a temporary table with data like:
I want to select from this table a simple result set with one row for each customer and the sum of sales for month to date and year to date. So for date 2/28/16 the result set would be:
I am trying to do it within one select statement but am having trouble with limiting the date range and grouping on customer in the same statement. My next idea is to create a temporary table that will just be a list of the customers and join them, but I I'm not sure about that route and think there must be an elegant solution I am missing.