Hi
I'm trying to output the previous 12 months and have the month name as the column heading. It doesnt want to let me use a function as the alias.
Does anyone have any ideas how I can do this please?
Thanks
Matt
I'm trying to output the previous 12 months and have the month name as the column heading. It doesnt want to let me use a function as the alias.
Code:
SELECT Department,
SUM(case when Month=MONTH((CURDATE() - INTERVAL 11 MONTH)) then Total else '0' end) AS DATE_FORMAT((CURDATE() - INTERVAL 11 MONTH), '%M-%Y'),
Does anyone have any ideas how I can do this please?
Thanks
Matt