将SQL转换为ActiveRecord

时间:2012-09-13 10:48:21

标签: sql ruby activerecord

我需要帮助将这一部分T-SQL转换为ActiveRecord查询

select entry
from faxlog
group by entry
having count(entry) >= 8

1 个答案:

答案 0 :(得分:1)

试试这个:

Faxlog.group(:entry).select("entry").having("count(entry) >= ?", 8)