@numRows = count_by_sql("SELECT COUNT(DISTINCT Opinions.id), SUM
(Ratings.score) as score_sum FROM Opinions
LEFT JOIN Ratings ON Opinions.id
Ratings.opinion_id WHERE score_sum > 20")
Will return us the SUM of COUNT(DISTINCT Opinions.id) AND SUM
(Ratings.score).
But we only need the value of COUNT(DISTINCT Opinions.id)
Is there a way to achieve that in rails?
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.