Equivalence of Queries with Nested Aggregation