Categories
Mastering Development

It is possible to do extra aggregation in filter clause? (PostgreSQL)

I want to write something like this: select “id”, “plant”, “product”, “uom”, count(*) as transactions_count, avg((“invoice_price” / “quantity”)) filter (where (“date” == max(date)) as “LAST_GUIDANCE”, — I want group by date only for this from “transactions” group by “id”, “plant”, “product”, “uom” Where I want to count last guidance but only for rows with last […]