@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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.


Reply via email to