select xm,gh,
max(case when date=1 then money else null end) as D1,
max(case when date=2 then money else null end) as D2,
max(case when date=3 then money else null end) as D3
from tablename
group by xm,gh
如果max显示不对的话换成min