0
我有這樣的SQL查詢:轉換SQL查詢ActiveRecord的查詢導軌4
sub = "(select Name from other_holders s where s.share_holder_id=share_holders.id and s.other_holder_type_id=1) as secondHolderName"
sub1 = "(select Name from other_holders s where s.share_holder_id=share_holders.id and s.other_holder_type_id=2) as thirdHolderName"
@shareHolders=ShareHolder.select("Folio_no,Name,#{sub},#{sub1}")
我從這個查詢獲得所需的結果,但隨着this.I想這整個查詢轉換爲我不滿意Activerecord查詢。請幫助我。
使用代碼後出現語法錯誤 –