Anda dapat menggunakan fungsi agregat dengan CASE
ekspresi untuk mengubah baris menjadi kolom:
select id,
extra_info,
sum(case when month = 'jan' then value else 0 end) jan,
sum(case when month = 'feb' then value else 0 end) feb,
sum(case when month = 'mar' then value else 0 end) mar,
sum(case when month = 'apr' then value else 0 end) apr,
sum(case when month = 'may' then value else 0 end) may,
sum(case when month = 'jun' then value else 0 end) jun,
sum(case when month = 'jul' then value else 0 end) jul,
sum(case when month = 'aug' then value else 0 end) aug,
sum(case when month = 'sep' then value else 0 end) sep,
sum(case when month = 'oct' then value else 0 end) oct,
sum(case when month = 'nov' then value else 0 end) nov,
sum(case when month = 'dec' then value else 0 end) "dec"
from yt
group by id, extra_info
Lihat SQL Fiddle dengan Demo