SELECT MIN(post.postid) AS minpost, MAX(post.postid) AS maxpost, thread.threadid, MAX(post.dateline) AS dateline,
(COUNT(*)-1) AS posts,
SUM(attachment.visible) AS attachsum
FROM post,thread
LEFT JOIN attachment ON attachment.attachmentid=post.attachmentid
WHERE thread.threadid=post.threadid
AND thread.threadid>=400
AND thread.threadid<2000
GROUP BY thread.threadid
ORDER BY threadid DESC;
(COUNT(*)-1) AS posts,
SUM(attachment.visible) AS attachsum
FROM post,thread
LEFT JOIN attachment ON attachment.attachmentid=post.attachmentid
WHERE thread.threadid=post.threadid
AND thread.threadid>=400
AND thread.threadid<2000
GROUP BY thread.threadid
ORDER BY threadid DESC;
When you get the error, you should be able to close in your band of results until, you find the exact thread that's causing the problem (assuming there's only one). That is, the red number would be (for example) 456, and the blue would be 457 (the blue has to be greater than the red!). Then, 456 would be the troublesome thread, and we have to remove it.
Although I do think this is some sort of MySQL bug. (Or is it a "feature"?)
Leave a comment: