select product
, sum(price) as price
from table
where price<1000
having price>10000
You can refer to the aliased price column before or after aggregation using where or having. Depending on the sql engine. select product
, sum(price) as price
from table
where price<1000
having price>10000
You can refer to the aliased price column before or after aggregation using where or having. Depending on the sql engine.Is there an implicit group by in this query?
If that's not a requirement, this approach can add some clarity