1. A computer-implemented method for transforming a query, comprising the steps of: generating a transformed query for the query, wherein: the query includes an outer query that has (1) a GROUP BY clause and (2) a HAVING clause that contains a subquery; the outer query includes a first set of one or more join operations; the subquery includes a second set of the one or more join operations; any join operation that is in the second set of one or more join operations is included in the first set of one or more join operations; any join operation that is in the first set of one or more join operations and not in the second set of one or more join operations is lossless; and at least one of the outer query and the subquery computes an algebraic aggregate function; and wherein generating the transformed query comprises the steps of: eliminating the subquery; creating an inline view, wherein the inline view: includes a set of join operations that is equivalent to the first set of join operations; includes a GROUP BY clause that is equivalent to the GROUP BY clause in the outer query; computes an algebraic aggregate window function that computes an algebraic aggregate function over a range; creating a predicate in the outer query that references the inline view; and wherein the steps of the method are performed by one or more computing devices.