Hi,
I know that aggregate function in where clause is not allowed but is there any alternative for this query
SELECT
SUM(inv.total_bill) AS total_bill,
MIN(store.code) AS code,
from mybucket inv
WHERE inv.type = 'invoice' AND SUM(inv.total_bill) > 500 ORDER BY total_bill DESC LIMIT 10