Group by clause : Map to SQL « ActiveRecord « Ruby






Group by clause


Account.find :all, :group => "last_name"

will result in the following SQL:

SELECT * FROM accounts GROUP BY last_name

 








Related examples in the same category

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