Issue #21858:fix missed group by
Merge pull request #290 from garyhgohoos/21858-2

Issue #21858:fix missed group by