mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Avoid adding two DISTINCT statements to queries in sqlite 2.
This commit is contained in:
committed by
Michael Koziarski
parent
a2028a7d7b
commit
55622e0bde
@@ -178,7 +178,7 @@ module ActiveRecord
|
||||
sql = "SELECT COUNT(*) AS #{aggregate_alias}" if use_workaround
|
||||
|
||||
sql << ", #{options[:group_field]} AS #{options[:group_alias]}" if options[:group]
|
||||
sql << " FROM (SELECT DISTINCT #{column_name}" if use_workaround
|
||||
sql << " FROM (SELECT #{distinct}#{column_name}" if use_workaround
|
||||
sql << " FROM #{connection.quote_table_name(table_name)} "
|
||||
if merged_includes.any?
|
||||
join_dependency = ActiveRecord::Associations::ClassMethods::JoinDependency.new(self, merged_includes, options[:joins])
|
||||
|
||||
Reference in New Issue
Block a user