added groupby query

so far only works for string fields