Announcement

Collapse
No announcement yet.

Custom mysql query for latest post, or threads

Collapse
X
Collapse
First Prev Next Last
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Custom mysql query for latest post, or threads

    Hi all,

    I would like to run a custom mysql query for the latest posts, and a separate one for latest threads

    I saw this post: https://vbmods.rocks/forum/vbulletin-5-modifications/vbulletin-5-miscellaneous-modifications/9299-custom-database-query

    which uses:
    PHP Code:
    SELECT n.*,nn.urlident purl FROM `node` n LEFT JOIN `node` nn ON (nn.nodeid = n.parentid) WHERE n.parentid IN (6649950,6649951,6649952,6649953) ORDER BY nn.textcount desc LIMIT 5 
    

    for posts, and
    PHP Code:
    SELECT n.*,nn.urlident purl FROM `node` n LEFT JOIN `node` nn ON (nn.nodeid = n.parentid) WHERE n.parentid IN (6649950,6649951,6649952,6649953) ORDER BY nn.totalcount desc LIMIT 5 
    
    for threads

    ...but I have a couple of questions:

    1. The only difference I can see here is what it is being ordered by. Is that really distinguishing the difference between posts and threads?
    2. Because I want to order by latest, I would be ordering by the "created" timestamp I assume, but wouldn't conflict with the above?
    3. The parent ID's are referencing categories, but I want to show the last post / thread regardless of the category, but when I do this it runs really slow.

    Any help to any of the above is appreciated! And if there is some documentation that explains the node table in details I would really appreciate it I can't seem to find any

    Thanks!!

Latest Posts

Collapse

Working...
X
Searching...Please wait.
An unexpected error was returned: 'Your submission could not be processed because you have logged in since the previous page was loaded.

Please push the back button and reload the previous window.'
An unexpected error was returned: 'Your submission could not be processed because the token has expired.

Please push the back button and reload the previous window.'
An internal error has occurred and the module cannot be displayed.
There are no results that meet this criteria.
Search Result for "|||"