Fixed broken SQL query for finding out number of blog posts to deliver