我想找到最近20天的審覈表,我已經寫了下面的MySQL查詢最新的數據:如何在rails 3活動記錄查詢中轉換以下查詢?
SELECT *
from (select * from audits ORDER BY id DESC) as x
where (auditable_type = 'Investment'
and auditable_id =41
and created_at <= '2011-12-01' AND created_at >= '2011-11-25')
group by date(created_at)
我想將其轉換爲Rails 3的活動記錄查詢,我應該怎麼做,我會得到兩個查詢的結果都一樣嗎?
爲什麼你需要在開始本次查詢? –