Displaying 2 results from an estimated 2 matches for "found_rows".
Did you mean:
found_os
2005 Dec 01
0
[MySQL] extended count function for use with queries containing a GROUP BY clause
...ry
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 COUNT...
2006 Feb 21
6
Select articles from group with id ''1'' and id ''2''
I have to tables: "articles" and "groups". Between I have
article_groups as a jointable. Now I want to select every article who
is a member of group with id ''1'' and id ''2''. Whats best way to get
that?
Extract from schemas:
CREATE TABLE articles (
id int auto_increment,
ingress text NOT NULL,
story_text longtext,
constraint fk_items_users