【问题标题】:I'm using mybb, how can I find the top 5 threads that has the most readers currently?我正在使用 mybb,如何找到当前拥有最多读者的前 5 个线程?
【发布时间】:2011-07-21 18:00:26
【问题描述】:

我正在使用MyBB,我想在我的网站主页上显示当前拥有最多读者的话题。

我假设我必须查询会话表,但我不知道该怎么做

我需要的 mysql 结果应该类似于:

-------------------------
|title          | count |
-------------------------
|thread a title | 1234  |
|thread b title | 913   |
|thread c title | 678   |
|another  title | 593   |
|different title| 550   |
-------------------------

谢谢你:)

【问题讨论】:

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

标签: mysql sql forum mybb


【解决方案1】:

我刚刚在我的板上进行了测试,我认为这就是您所需要的:

SELECT COUNT(*) as count, subject as title
FROM `mybb_sessions`,`mybb_threads`
WHERE location1 = tid
GROUP BY `location1`
ORDER BY COUNT(*) DESC
LIMIT 10

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-03-15
    • 1970-01-01
    • 1970-01-01
    • 2012-02-20
    • 1970-01-01
    • 2012-05-21
    相关资源
    最近更新 更多