2017-09-14 25 views
-2

讓我們說我有改寫紅寶石活動記錄sql語句

class KdpReport < ActiveRecord::Base 
end 

如何翻譯使用的活動記錄模型紅寶石這個sql語句?

SELECT DISTINCT 
     `kdp_reports`.`date` AS `date`, 
     `kdp_reports`.`book_title` AS `book_title`, 
     `kdp_reports`.`marketplace` AS `marketplace` 
FROM 
    `kdp_reports` 

我用紅寶石 「2.4.0」 和活動記錄寶石沒有護欄

我只能想到這樣的事情:

KdpReport.select(:date).distinct.select(:book_title).distinct.select(:marketplace).distinct 
+0

你提出的解決方案不正是你'要求。什麼是問題?請停止在StackOverflow上運行shitposting。 – coreyward

回答