[英]I'm using mybb, how can I find the top 5 threads that has the most readers currently?
我正在使用MyBB ,我想在我的網站主頁上顯示目前擁有最多讀者的主題。
我假設我必須查詢 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
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.