私がやりたいとしましょう
SELECT persons.name, cars.registration FROM persons, cars
WHERE persons.state=cars.state AND persons.state_id_number=cars.owner_id_number ;
ヒント:異なる州の人々は同じものを持つことができますがstate_id_number
、それは州内でユニークです。
できます
People.find_by_sql("SELECT persons.name, cars.registration FROM persons, cars
WHERE persons.state=cars.state AND persons.state_id_number=cars.owner_id_number")
レコードのリストを取得します。
しかしfind(:all, :conditions => {
、同じことをするためにフォーマットを使用できますか?