My analytics involves the need to aggregate rows and to store the number of different values occurrences of a field someField
in all the rows.
Sample data structure
[someField, someKey]
I'm trying to GROUP BY someKey
and then be able to know for each of the results how many time there was each someField
values
Example:
[someField: a, someKey: 1],
[someField: a, someKey: 1],
[someField: b, someKey: 1],
[someField: c, someKey: 2],
[someField: d, someKey: 2]
What I would like to achieve:
[someKey: 1, fields: {a: 2, b: 1}],
[someKey: 2, fields: {c: 1, d: 1}],