我使用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