条件付き集計でピボットできます:
select year(d_date) yr, sum(case when month(d_date) = 1 then amount end) Jan, sum(case when month(d_date) = 2 then amount end) Feb, sum(case when month(d_date) = 3 then amount end) Mar, ... sum(case when month(d_date) = 12 then amount end) Dec, sum(amount) total from mytable group by year(d_date) order by yr
プレ>