Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Hive, mail # user - Multi Table Join & count Distinct


Copy link to this message
-
Re: Multi Table Join & count Distinct
Nitin Pawar 2012-05-22, 05:40
try removing C1,C2 and C3 from select

count should give you exactly one output, where as c1,c2,c3 may vary as per
table

On Tue, May 22, 2012 at 5:02 AM, cmdr taco <[EMAIL PROTECTED]> wrote:

> When I try to run below query, but for some reason I'm
> getting weird results  for the  C2_CNT, its not giving distinct value count
>
>
> SELECT
>  C1,C2,C3
> ,COUNT(DISTINCT B.C2) C2_CNT
> ,COUNT(C.C2) CC_CNT
> FROM
> TABLE_A A
> JOIN TABLE_B B on (A.C1=B.C1  )
> left outer join  TABLE_C C on (B.C2 = C.C2  )
> group by C1,C2,C3
>
>
>
>
--
Nitin Pawar