I am showing the sales in my Database using this select
SELECT YEAR( ordered_date ) AS Jahr, SUM( preis ) AS Preis, count(*) as Anzahl FROM wccrm_orders where typ = 'Brautkleid' GROUP BY YEAR(ordered_date) ORDER BY ordered_date ASC
This is working fine, currently the output is year (1-12), the number and the price. Now I need to achieve the following:
The Price, Count(*) and Year should not be shown from Jan to Dec, but from Sep to Sep. Is this possible? How can I achieve this?
Kind Regards,
Stefan
Subtract 9 months or add 3 months (I'm not sure what you want to call "Jahr"):
SELECT YEAR( ordered_date + interval 3 month) AS Jahr,
SUM( preis ) AS Preis, count(*) as Anzahl
FROM wccrm_orders
WHERE typ = 'Brautkleid'
GROUP BY Jahr
ORDER BY Jahr ASC;