hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From javateck javateck <javat...@gmail.com>
Subject Re: some fancy join or union support?
Date Wed, 01 Apr 2009 19:40:41 GMT
this is working exactly as what I want, thanks a lot, very simple, but it
seems that I can't see the details from wiki site.

On Wed, Apr 1, 2009 at 12:23 PM, Raghu Murthy <rmurthy@facebook.com> wrote:

> You can do it in one pass:
>
> select sum(if(col2 = 'some', 1, 0))/sum(if(col2 <> 'some', 1, 0)) from tab
>
>
> On 4/1/09 12:16 PM, "javateck javateck" <javateck@gmail.com> wrote:
>
> > can I do something like
> >
> > select m1.c1/m2.c2 from ((select count(col1) as c1 from tab where
> > col2=='some') m1 join (select count(col1) as c2 from tab where
> col2<>'some')
> > m2)
> >
> > I know this syntax is not working, my purpose is to get the percentage
> out,
> > not sure if union can do it if join can't.
>
>

Mime
View raw message