0
幫我寫紅寶石GROUP_BY條件。我現在必須將PHP項目遷移到Ruby,並面對這個問題。不要嚴格判斷,我是Ruby的新手。如何在ruby中編寫GROUP BY SQL查詢?
這是在PHP查詢:
$get_details_email = db_query("Select secret_key,trustee_status,email_id from trustees where request_by='email' AND user_id='$user_id' group by email_id");
如何在EMAIL_ID組下面的查詢?
get_details_email = Trustee.select(:secret_key, :trustee_status, :email_id).where(:request_by => 'email', :user_id => user_id)