我正在使用MyBB,我想在我的网站主页上显示当前拥有最多读者的主题.
我假设我必须查询会话表但我不知道该怎么做
我需要的mysql结果应该是这样的:
-------------------------
|title | count |
-------------------------
|thread a title | 1234 |
|thread b title | 913 |
|thread c title | 678 |
|another title | 593 |
|different title| 550 |
-------------------------
谢谢 :)
解决方法:
我刚刚在我的板上测试过,我认为这就是你需要的:
SELECT COUNT(*) as count, subject as title
FROM `mybb_sessions`,`mybb_threads`
WHERE location1 = tid
GROUP BY `location1`
ORDER BY COUNT(*) DESC
LIMIT 10