Is there a "better" way to refactor the query below that returns the number occurrences of a particular value (e.g. \'A\') for each distinct id<
\'A\'
id<