SELECT
order_items_base.user_id as user_id,
count(distinct ii_0.product_brand) as brand_count
FROM `malloy-data.ecomm.order_items` as order_items_base
LEFT JOIN `malloy-data.ecomm.inventory_items` AS ii_0
ON order_items_base.inventory_item_id = ii_0.id
GROUP BY 1
ORDER BY 2 desc
We should probably not allow this and throw a reasonable error about disallowed aggregates in a group_by, rather than quietly not putting the field in the SQL's GROUP BY.
This query currently runs:
and produces this SQL
We should probably not allow this and throw a reasonable error about disallowed aggregates in a group_by, rather than quietly not putting the field in the SQL's GROUP BY.