Well I got it somewhat working. I used this to get just one set of data: select cellid, ValueCount((COLLECT DISTINCT Network)) as networks, StringJoinTokens(Network, ', ') as networknames from (select cellid, SPLIT(COLLECT DISTINCT Network) from my_table Group by cellid) Group by cellid order by cellid; 
I get another set like this: select cellid, ValueCount((COLLECT DISTINCT radio)) as radios, StringJoinTokens(radio, ', ') as technology from (select cellid, SPLIT(COLLECT DISTINCT radio) from my_table Group by cellid) Group by cellid order by cellid; 
But I want them both at the same time in the same table so I tried this: Select cellid,ValueCount((COLLECT DISTINCT Network)) as networks, StringJoinTokens(Network, ','), ValueCount((COLLECT DISTINCT radio)) as radios, StringJoinTokens(radio, ',') from (select cellid, SPLIT(COLLECT DISTINCT Network), SPLIT(COLLECT DISTINCT radio) from my_table Group by cellid) Group by cellid order by cellid; however this last result while showing the unique values listed the string values twice and I'm not sure why: 
I'd like to combine some other sums and counts with them as well, but if I could get this all in one table like shown above with the correct number of strings listed, that would be a good start.
|