Use group aggregation for stats