• Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.

    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

SQL: Need Rows with Non-Zero Values


New Coder
Hi all! I'm conducting an analysis on spending. I'm trying to find how much individual customers have spent every month in the last year. I'm working with transaction data so we only have rows for transactions that actually happened. Therefore, for customer A who only transacted in January, February, and April, I want that customer to have rows that say "$0" for March, May, June, etc. so that I can get 12 rows of months of data for that customer rather than just 3.

Please let me know if you need any clarifying questions! I've tried approaching this with left joins, insertions, etc. but haven't had any fruition.

New Threads

Buy us a coffee!

Top Bottom