Aggregate function and group by
Account.find :all, :select => "COUNT(last_name) AS total, *", :group => "last_name" which would result in the following SQL: SELECT COUNT(last_name) AS total, * FROM accounts GROUP BY last_name
1. | The :order parameter defines the sorting order. | ||
2. | Group by clause | ||
3. | Left join | ||
4. | Left join on a column | ||
5. | Limit offset |