diff --git a/framework/core/src/Post/Post.php b/framework/core/src/Post/Post.php index 8c508aa9a..8c72f6c53 100644 --- a/framework/core/src/Post/Post.php +++ b/framework/core/src/Post/Post.php @@ -98,7 +98,7 @@ class Post extends AbstractModel $db = static::getConnectionResolver(); $post->number = new Expression('('.$db ->table('posts', 'pn') - ->whereRaw('pn.discussion_id = '.intval($post->discussion_id)) + ->whereRaw($db->getTablePrefix().'pn.discussion_id = '.intval($post->discussion_id)) ->select($db->raw('max('.$db->getTablePrefix().'pn.number) + 1')) ->toSql() .')');