My goal is to return a row of month name with a column of Year
. This is to get the sum of sales of one particular tenant in a per year and month table.
I have started to this code
select
month(date) month,
isnull(sum(case when year(DATE) = 2015 then sales end), 0) as '2015'
from
tblSales
where
tenantcode = 'cmbina13'
group by
month(date)
order by
month(date)
and I get back this result:
The figures are correct. However I want to make month column turn into month name. Like this image below as desired output