with fmnm_list as
(
select round(hong,2) hong,round(kim,2) kim,round(lee,2) lee,round(park,2) park,round(shin,2) shin,round(choi,2) choi
from (
select substr(column_1,1,1) fnm,avg(column_2) avg_age
from my_table_1 a
group by substr(column_1,1,1)
)
pivot (avg(avg_age) for fnm in ('홍' as hong,'김' as kim,'이' as lee,'박' as park,'신' as shin,'최' as choi))
)
select *
from fmnm_list a
unpivot (age for fnm in (hong as 'H',kim as 'K',lee as 'L',park as 'P',shin as 'S',choi as 'C'))
;
comments powered by Disqus