• you have to change your query to query first from a Calendar table of some sort, which contains all possible dates.

    then your CTE left joins to that Calendar table.

    with that in place, you'll be able to get zero totals for dates that had no data form the other tables.

    ...

    FROM CalendarTable

    LEFT OUTER JOIN cte d

    ON CalendarTable.TheDate = d.Date

    ...

    there's quite a few example of it here on ssc:

    http://www.sqlservercentral.com/search/?q=calendar+table

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!