Subquery With Aggregate Function Definition