I’m trying to sum
totalSales based on the
month selected, i.e if March is selected then sum
totalSales from January to March
SELECT * FROM (SELECT month, year, SUM(totalSales) OVER (PARTITION BY year ORDER BY FIELD(month, 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December')) AS totalSales ) temp WHERE year=2021 AND month='May'
Answered By – Matt
Answer Checked By – David Goodson (BugsFixing Volunteer)