Given the list of categories and sub-categories:
CatA SubCatA
CatA SubCatA
CatB SubCatB
CatB SubCatB
CatC SubCatC
CatC SubCatC
I'd like to return all unique main categories based on the secondary category.
I don't want to use:
=QUERY(A1:B6,"SELECT A WHERE B = 'SubCatA'")
as it's returning the list with duplicates (returning first element won't help either).
What I'm trying is:
=QUERY(A1:B6,"SELECT A WHERE B = 'SubCatA' GROUP BY A")
but it gives me the error: CANNOT_GROUP_WITHOUT_AGG
, therefore I'm trying to find something equivalent to either DISTINCT(A)
or UNIQUE(A)
, but these functions doesn't exist.
Is there any function in Google Visualization API Query Language equivalent to DISTINCT/UNIQUE to return list of unique values?