The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Forumhome attachment query
Hello,
I want to do a query in a plugin on the forumhome that is rather difficult for me to do. I want to query the latest submitted attachment of 4 different forums (one attachment for each forum). I had a look at the attachment database table, but there is of course no info in which forum the attachment was posted. So the query would probably consist of several joins (qeurying the latest thread of a forum and then querying the latest attachment of that forum). Can anybody help, please? |
#2
|
|||
|
|||
How do I query the latest attachment in a certain forum, please?
|
#3
|
|||
|
|||
Bump. I'm still looking for a way to do this.
--------------- Added [DATE]1228043619[/DATE] at [TIME]1228043619[/TIME] --------------- I guess the way to do this is find out the latest thread in a forum and then query the first attachment in this thread. Should not be impossible. The forumhome shows info about the latest thread already... |
#4
|
|||
|
|||
I'm also looking for a way to do this.
|
#5
|
|||
|
|||
Maybe something like this:
Code:
"SELECT attachmentid FROM " . TABLE_PREFIX . "attachment AS attachment LEFT JOIN " . TABLE_PREFIX . "post AS post ON ( post.postid = attachment.postid ) LEFT JOIN " . TABLE_PREFIX . "thread AS thread ON ( thread.threadid = post.threadid ) WHERE thread.forumid IN ( 1, 2, 3 ) ORDER BY attachment.dateline DESC" which finds attachment ids from forums 1, 2, or 3, newest ones first. I'm really just an SQL beginner so I don't know how you would do what the OP wants in one query. I suppose you could query all the attachments and read them until you find one from each forum, but i don't know how you'd do a query to return exactly one from each forum. |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|