0
SQL:如何將其轉換爲rails查詢?
SELECT *
FROM PROFILES
WHERE last_name = 'aiu' AND first_name ='david'
GROUP BY first_name, last_name, middle_name, zip_code, street
代碼:
Profile.all(:conditions => ["first_name = ? OR last_name = ?", params[:first_name], params[:last_name]], :group => "first_name, last_name, middle_name, zip_code")
這是正確的?
看起來是正確的,除了所有在你'姓氏= '美亞' AND FIRST_NAME ='david''和軌道'FIRST_NAME =查詢? OR last_name =?'。 你使用rails 2.3嗎? – alony 2012-02-08 10:57:53