SELECT a.uid,a.username,p.pingf FROM hfwk_space as a,(SELECT sum(pingf) as pingf from hfwk_pf where hfwk_pf=a.uid) as p ORDER BY p.pingf DESC上面这个语句是我写的。。但是不对。。我想读取hfwk_space 这个表的人明。但是又能统计这个用户的评分,hfwk_pf 这个表里存的是其他用户对他的评分、我想读取这些用户总评分。然后评分多的排在第一位。。
调试欢乐多
select a.uid,a.username,sum(p.pingf) from hfwk_space as a left join hfwk_pf as p on a.uid=p.uid group by p.uid order by sum(p.pingf) desc;