select
Sum(case when name='A' then age else null end) as Aage,
Sum(case when name='A' then sex else null end) as Asex,
Sum(case when name='A' then kg else null end) as Akg,
Sum(case when name='B' then age else null end) as Bage,
Sum(case when name='B' then sex else null end) as Bsex,
Sum(case when name='B' then kg else null end) as Bkg,
Sum(case when name='C' then age else null end) as Cage,
Sum(case when name='C' then sex else null end) as Csex,
Sum(case when name='C' then kg else null end) as Ckg
from Student
这个着实没搞过