Skip to content

Commit 89f8e7d

Browse files
authored
Update wp_bbp_topics.sql
1 parent ee26ea2 commit 89f8e7d

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

generate/updates/wp_bbp_topics.sql

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,13 @@
11
/* Update last_reply_id, last_active_id */
22
UPDATE wp_bbp_topics t
3-
LEFT JOIN (
3+
INNER JOIN (
44
SELECT t.topic_id, MAX(p.ID) AS last_reply_id
55
FROM wp_bbp_topics t
66
INNER JOIN wp_posts p ON p.post_parent = t.topic_id AND p.post_type = 'reply'
77
WHERE p.post_status IN ('publish')
88
GROUP BY t.topic_id) r ON t.topic_id = r.topic_id
99
SET t.last_reply_id = r.last_reply_id, t.last_active_id = r.last_reply_id;
1010

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-
1611
/* Update last_active_time */
1712
UPDATE wp_bbp_topics t
1813
INNER JOIN wp_posts p ON p.ID = t.last_active_id

0 commit comments

Comments
 (0)