diff --git a/phpBB/includes/acp/acp_main.php b/phpBB/includes/acp/acp_main.php
index 144b225766..eb613535bf 100644
--- a/phpBB/includes/acp/acp_main.php
+++ b/phpBB/includes/acp/acp_main.php
@@ -210,7 +210,7 @@ class acp_main
 						// No maximum post id? :o
 						if (!$max_post_id)
 						{
-							$sql = 'SELECT MAX(post_id)
+							$sql = 'SELECT MAX(post_id) as max_post_id
 								FROM ' . POSTS_TABLE;
 							$result = $db->sql_query($sql);
 							$max_post_id = (int) $db->sql_fetchfield('max_post_id');