Hi everyone,
I have a table named orders with the following columns:
orderdate (Date of the order)
sales (Sales amount for the order)
I am looking to write a query that will help me calculate the sales at a monthly level and show how each month's sales contribute to the yearly sales as a percentage.
Here's what I'm aiming to achieve in the output:
year (The year of the sales)
month (The month of the sales)
monthly_sales (Total sales for that month)
sales_contribution (Contribution of the month's sales to the yearly sales as a percentage)
Could someone help me with the SQL query to achieve this?
Thanks in advance!