![]() |
Query top 5 threads
Hello, since that vbulletin's database is sooo big, am having a hell of a time trying to get the details of each tables (plus i have a crappy internet connection), the thing is, i wish to display the top 5 threads according to the number of views a thread got, but i don't know the table names and field names i must use.
NOTE: Assume that i am using the normal unmodified prefix of vbulletin's table and field format. the displaying of the top 5 is trivial, since it is just a while loop, but i don't know what query i must use to get the thread id, name and its number of views (am confused with soo much of tables.) thanks +la |
[sql]SELECT *
FROM " . TABLE_PREFIX . "thread ORDER BY dateline LIMIT 5[/sql] Then just do a while loop to loop through the thread's data. |
The above query will show the threads by creation. The thread table actually has a views field, which can be used (though in vanilla VB it is not indexed, so it's a very inefficient query).
[sql]SELECT threadid, title, views FROM " . TABLE_PREFIX . "thread ORDER BY views desc LIMIT 5[/sql] |
All times are GMT. The time now is 01:28 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|