Bila Anda ingin melakukan agregasi seperti SUM atau COUNT, Anda hanya dapat memilih kolom tempat Anda melakukan GROUP BY.
ShopifyOrderLineItem.select("shopify_order_line_items.title, count(shopify_order_line_items.id) as unique_ids, sum(amount) as total_price, sum(quantity) as total_quantity").where(:vendor_id => vendor_id).group("shopify_order_line_items.title")