case:
SELECT stdname,
max( CASE WHEN stdsubject = '语文' THEN result ELSE 0 END) "语文",
max( CASE WHEN stdsubject = '数学' THEN result ELSE 0 END) "数学",
max( CASE WHEN stdsubject = '物理' THEN result ELSE 0 END) "物理" ,
max( CASE WHEN stdsubject = '化学' THEN result ELSE 0 END) "化学"
FROM std
GROUP BY stdname;