试试这样,另外它报什么错?SELECT * FROM `fwxm` m ,(select xmid,sum(jyje) ss from jyxx group by xmid) n WHERE m.id=n.xmid order by n.ss