Need some help with aggregation for this particular case