The problem is the normal way of fixing this, using a DISTINCT statement, is ambiguous because, well, which row of the repeating rows will it return? It doesn't seem to have that kind of logic checking. However you can sort of hack it into submission like so.
[sql]$querya = $vbulletin->db->query_read("
SELECT MAX(post.postid), post.pagetext, post.userid, post.username, thread.forumid, thread.title AS titulo, thread.threadid, forum.forumid, forum.title
FROM " . TABLE_PREFIX . "post AS post
LEFT JOIN " . TABLE_PREFIX . "thread AS thread ON (post.threadid = thread.threadid)
LEFT JOIN " . TABLE_PREFIX . "forum AS forum ON (thread.forumid = forum.forumid)
WHERE forum.forumid NOT IN ($excluded)
GROUP BY thread.threadid
ORDER BY postid DESC
LIMIT $limit"
);[/sql]
|