Translate this SELECT to ActiveRecord
I need to translate this SELECT to ActiveRecord but I don开发者_JAVA百科't get the desire result. Can you help me? The SELECT is:
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;
Thank you very much.
I solved this question with ActiveRecord::Base.connection.execute
Thanks
精彩评论