summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Bridge.php6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/Bridge.php b/src/Bridge.php
index 9753470..2afbd34 100644
--- a/src/Bridge.php
+++ b/src/Bridge.php
@@ -28,10 +28,10 @@ class Bridge {
$sql = 'SELECT p1.message_id FROM posts AS p1 ' .
'LEFT OUTER JOIN posts AS p2 ON (' .
- 'p1.post_id = ' . $postId . ' AND ' .
- 'p2.post_id = ' . $postId . ' AND ' .
+ 'p1.post_id = p2.post_id AND ' .
'p1.edit_id < p2.edit_id' .
- ') WHERE p2.post_id IS NULL';
+ ') WHERE p1.post_id = ' . $postId . ' AND ' .
+ 'p2.post_id IS NULL';
$row = $this->get_exactly_one_row($sql);
return $row ? $row['message_id'] : false;