Bạn đã đóng:
select age, nvl(male, 0) male, nvl(female, 0) female
from
(
select age, gender, sum(hours) as hours
from table1
group by age, gender
)
pivot
(
sum(hours) for gender in ('Male' as male, 'Female' as female)
);
Bạn đã đóng:
select age, nvl(male, 0) male, nvl(female, 0) female
from
(
select age, gender, sum(hours) as hours
from table1
group by age, gender
)
pivot
(
sum(hours) for gender in ('Male' as male, 'Female' as female)
);