Only compute aggregate functions once, and only return one row if all aggregate functions.