34,837
社区成员




select dep , 时间 = '1900-1902',
sum(case when year(BirthYear) 1900 and 1902 and 学位 = '博士' then 1 end) '博士',
sum(case when year(BirthYear) 1900 and 1902 and 学位 = '硕士' then 1 end) '硕士',
sum(case when year(BirthYear) 1900 and 1902 and 学位 = '学士' then 1 end) '学士',
sum(case when year(BirthYear) 1900 and 1902 then 1 end) '总计'
from tb group by dep
union all
select dep , 时间 = '1903-1905',
sum(case when year(BirthYear) 1903 and 1905 and 学位 = '博士' then 1 end) '博士',
sum(case when year(BirthYear) 1903 and 1905 and 学位 = '硕士' then 1 end) '硕士',
sum(case when year(BirthYear) 1903 and 1905 and 学位 = '学士' then 1 end) '学士',
sum(case when year(BirthYear) 1903 and 1905 then 1 end) '总计'
from tb group by dep
union all
select dep , 时间 = '1906-1908',
sum(case when year(BirthYear) 1906 and 1908 and 学位 = '博士' then 1 end) '博士',
sum(case when year(BirthYear) 1906 and 1908 and 学位 = '硕士' then 1 end) '硕士',
sum(case when year(BirthYear) 1906 and 1908 and 学位 = '学士' then 1 end) '学士',
sum(case when year(BirthYear) 1906 and 1908 then 1 end) '总计'
from tb group by dep