From 8208a2341ea21556bedec9f70ae9ba26ea39ea5f Mon Sep 17 00:00:00 2001 From: r888888888 Date: Sun, 3 Jan 2016 13:23:29 -0800 Subject: [PATCH] fix sql query --- app/models/post.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/post.rb b/app/models/post.rb index 537cc007b..789155995 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -1082,7 +1082,7 @@ class Post < ActiveRecord::Base sum = 0 while i > 0 count = Post.with_timeout(options[:statement_timeout] || 500, nil, :tags => tags) do - sum += Post.tag_match(tags).where("id between <= ? and > ?", i, i - 25_000).count + sum += Post.tag_match(tags).where("id <= ? and id > ?", i, i - 25_000).count i -= 25_000 end