We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ee26ea2 commit 89f8e7dCopy full SHA for 89f8e7d
generate/updates/wp_bbp_topics.sql
@@ -1,18 +1,13 @@
1
/* Update last_reply_id, last_active_id */
2
UPDATE wp_bbp_topics t
3
-LEFT JOIN (
+INNER JOIN (
4
SELECT t.topic_id, MAX(p.ID) AS last_reply_id
5
FROM wp_bbp_topics t
6
INNER JOIN wp_posts p ON p.post_parent = t.topic_id AND p.post_type = 'reply'
7
WHERE p.post_status IN ('publish')
8
GROUP BY t.topic_id) r ON t.topic_id = r.topic_id
9
SET t.last_reply_id = r.last_reply_id, t.last_active_id = r.last_reply_id;
10
11
-/* Update last_active_id if it is 0 */
12
-UPDATE wp_bbp_topics t
13
-SET t.last_active_id = t.topic_id
14
-WHERE t.last_active_id = 0;
15
-
16
/* Update last_active_time */
17
18
INNER JOIN wp_posts p ON p.ID = t.last_active_id
0 commit comments