Hi again :-)

I have another question regarding whether it's possible to construct a Hive
query to do the following:

Let's say that I have a table that has an id column and a column named col.
Is it possible to write a Hive query to get back counts of the various
values of 'col' grouped by the id column?

So, something like this:


ID, COL VAL 1, COL VAL 2, COL VAL 3
1 153, 156, 540
2 99, 85, 194

I know I could write something like: select id,
sum(if(col=1,1,0)),sum(if(col=2,1,0)),sum(if(col=3,1,0)) group by id;

However, what if I want the same output from the query above but WITHOUT
enumerating all of the possible values of "col" ?

Thanks!

Ryan

Reply via email to