Open
Description
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.
Metadata
Metadata
Assignees
Labels
No labels