将此SELECT转换为ActiveRecord

时间:2010-11-12 09:11:13

标签: ruby-on-rails activerecord ruby-on-rails-3

我需要将此SELECT转换为ActiveRecord,但我没有获得所需的结果。你能帮助我吗? SELECT是:

SELECT SUM(quantity) FROM (SELECT recipients.lang,COUNT(name) AS quantity FROM messages, recipients WHERE messages.lang=recipients.lang AND active=1 GROUP BY lang) AS temp;

非常感谢。

1 个答案:

答案 0 :(得分:0)

我用ActiveRecord :: Base.connection.execute

解决了这个问题

由于