Using aggregate function instead

aggregate function does this apparently too