hive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From MIS <misapa...@gmail.com>
Subject count of distinct FROM multiple columns
Date Fri, 22 Jun 2012 12:32:13 GMT
Hi All,

I have a table in Hive as below:

dummy {
    col1 STRING,
    col2 INT,
    col3 INT
}

And in that there is some sample data as :

*col1  col2 col3 *
ABC    4    5
XYZ    1    2
ABC    1    3
ABC    5    1
XYZ    3    1

What should be my query so as to get the below result:

*ABC 4
XYZ 3*

Basically I'm trying to get a count of distinct elements from *col2 and
col3 combined* and group them against col1.

I tried with a query as:

select col1, count(distinct col2, col3) from dummy group by col1

But didn't get the expected output.

Can anybody point me in the correct direction and suggest a correct query.

Thanks.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message