Mysql I';我在使用mybb,如何找到目前拥有最多读者的前5个线程?

Mysql I';我在使用mybb,如何找到目前拥有最多读者的前5个线程?,mysql,sql,forum,mybb,Mysql,Sql,Forum,Mybb,我正在使用,我想在我的网站主页上显示当前拥有最多读者的帖子 我假设我必须查询session表,但我不确定该如何做 我需要的mysql结果应该如下所示: ------------------------- |title | count | ------------------------- |thread a title | 1234 | |thread b title | 913 | |thread c title | 678 | |another title |

我正在使用,我想在我的网站主页上显示当前拥有最多读者的帖子

我假设我必须查询session表,但我不确定该如何做

我需要的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

session
表是什么样的?MyBB有一个
前缀\u sessions
表,用于存储当前访问者的所有会话及其位置