search for: sql_calc_found_row

Displaying 1 result from an estimated 1 matches for "sql_calc_found_row".

Did you mean: sql_calc_found_rows
2005 Dec 01
0
[MySQL] extended count function for use with queries containing a GROUP BY clause
...owing query will return. In order to bypass this problem, I created the following replacement for ActiveRecord::Base.count: module ActiveRecord class Base class << self def count(conditions = nil, joins = nil) if joins =~ /GROUP BY/ sql = "SELECT SQL_CALC_FOUND_ROWS * FROM #{table_name} " sql += joins if joins sql += '' LIMIT 0'' add_conditions!(sql, conditions) connection.execute(sql) sql = ''SELECT FOUND_ROWS()'' else sql = "SELECT COUN...