Nested Aggregate Functions Postgresql W3schools Mysql Queries