0
我想選擇所有調查的計數,其中的survey.property.address.city == "Garrison"
。我有以下型號:使用Rails模型作爲參考的多個連接的SQL查詢
Survey
many_to_one :property
Property
one_to_many :surveys
many_to_one :address
Address
one_to_many :properties
如何使用SQL進行查詢?
SELECT count(*) FROM surveys JOIN...
謝謝!這使我朝着正確的方向前進。我只是將'JOINS'改爲'JOIN',將雙引號改爲單引號。 – jozwright