← Back to context

Comment by 0cf8612b2e1e

1 year ago

Indeed. Just as I think git’s N different ways to refer to the same operation was a blunder.

But pre- and post- aggregation filtering is not really "the same" operation.

  • If I use a CTE and filter the aggregate, feels the same to me.

    • If you perform an aggregation query in a CTE, then filter on that in a subsequent query, that is different, because you have also added another SELECT and FROM. You would use WHERE in that case whether using a CTE or just an outer query on an inner subquery. HAVING is different from WHERE because it filters after the aggregation, without requiring a separate query with an extra SELECT.

      2 replies →