You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by ws <wl...@yahoo.com> on 2016/03/12 22:25:43 UTC

Query question.

I need to re-write something like this to Hive:
###select  x.A, sum(0.5 * (select (count(*) from Table_X tx where tx.blah = 0.75)))from Table_X x###
Thanks in advance for any pointer to it.

Re: Query question.

Posted by Mich Talebzadeh <mi...@gmail.com>.
That

select (count(*) from Table_X tx where tx.blah = 0.75

will return a single value y and 0.5 * y will be a single value.. Where
does sum come into it. It is normally applied to GROUP BY statements.

Can you provide the original SQL if you have (Oracle, Sybase whatever)?

HTH

Dr Mich Talebzadeh



LinkedIn * https://www.linkedin.com/profile/view?id=AAEAAAAWh2gBxianrbJd6zP6AcPCCdOABUrV8Pw
<https://www.linkedin.com/profile/view?id=AAEAAAAWh2gBxianrbJd6zP6AcPCCdOABUrV8Pw>*



http://talebzadehmich.wordpress.com



On 12 March 2016 at 21:25, ws <wl...@yahoo.com> wrote:

> I need to re-write something like this to Hive:
>
> ###
> select  x.A,
> sum(0.5 * (select (count(*) from Table_X tx where tx.blah = 0.75)))
> from Table_X x
> ###
>
> Thanks in advance for any pointer to it.
>