列转行oracle列转换成行_oracle列转换成行

select name "姓名",
sum(decode(salary_type,'基本工资',cnt ,0)) "基本工资",
sum(decode(salary_type,'交通补贴',cnt ,0)) "交通补贴'",
sum(decode(salary_type,'全勤奖',cnt ,0)) "全勤奖",
sum(decode(salary_type,'效益奖',cnt ,0)) "效益奖",
from salary_composite
group by name;