Left join on a column : Map to SQL « ActiveRecord « Ruby






Left join on a column


Account.find :all,
             :from => "visits LEFT JOIN accounts ON visits.account=accounts.id"

And the following SQL query will result:

SELECT * FROM visits LEFT JOIN accounts ON visits.account=accounts.id

 








Related examples in the same category

1.The :order parameter defines the sorting order.
2.Group by clause
3.Aggregate function and group by
4.Left join
5.Limit offset