我正在编写一个列表系统,我试图通过评论数和投票数从2个表中获取帖子ORDER。MySQL的查询命令在GROUP BY 3中的结果表计数
Table1 : Lists => id, title, detail
Table2 : Votes => voteid, listid
Table3 : Comments => commentid, listid
WHERE我现在查询是
$q = mysql_query("SELECT * FROM zoo_leads
LEFT JOIN Votes ON Lists.id=Votes.listid
LEFT JOIN Comments ON Lists.id=Comments.listid
GROUP BY Lists.id ORDER BY Comments.listid DESC LIMIT 10
它显示了我的结果完美,但ORDER BY是Lists.id相反投票数和评论
也许问题是,有没有COUNT()。 – 2011-06-09 10:01:15