Left join : Map to SQL « ActiveRecord « Ruby
- Ruby
- ActiveRecord
- Map to SQL
Left join
Account.find :all,
:joins => "LEFT JOIN visits ON accounts.id=visits.account"
The result will be the following SQL query:
SELECT * FROM accounts LEFT JOIN visits ON accounts.id=visits.account_id
Related examples in the same category