You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have something like a Products table and a Sales table. So a product has many sales. I would like to filter for products with total sales value over X. So my SQL is something like
Product.left_outer_joins(:sales).select("products.id", "SUM(DISTINCT sales.quantity AS sales_quantity)")
but the problem is that the datatable total rows and page rows queries use a .count which removes the select'd columns but still want to retain my having("sales_quantity > X") condition. So the query fails because there is no "sales_quantity" column.