On January 21th at 14:15 UTC , progression through exercises will be unavailable for 10 minutes due to a planned maintenance break.
Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Window functions and GROUP BY
Summary and Review


As you can see, the query failed. However, let's take a look at another modification of this example:

  MAX(FinalPrice) AS MaxFinal,
  AVG(MAX(FinalPrice)) OVER() AS AvgMaxFinalPrice
FROM Auction
GROUP BY CategoryId;

What will happen now?


Run the template.

This query succeeded because we used an aggregate function (MAX(FinalPrice)) that was indeed available after grouping the rows. By the way, this is the only place where you can nest aggregate functions inside one another.