表table1
userid score1 score2
aa 10 Null
bb 20 Null
cc 30 Null
aa Null 11
bb Null 21
cc Null 31
表结构也可以是
userid score stype
aa 10 score1
bb 20 score1
cc 30 score1
aa 11 score2
bb 21 score2
cc 31 score2
如何得到
userid score1 score2
aa 10 11
bb 20 21
cc 30 31
------解决方案--------------------
select userid,max(score1) as score1,max(score2) as score2
from table1
group by userid