


Aggregate Multiple Columns
richin.jain@... 20120816, 14:28
Hello,
Is there a way to aggregate multiple columns in Hive? I can do it in two separate queries but is there something similar to sum(col1,col2)?
Thanks, Richin
+
richin.jain@... 20120816, 14:28

Re: Aggregate Multiple Columns
Jan Dolinár 20120816, 16:06
Hi Richin,
Do you mean summing the values from two columns into one number, or calculating sum of both columns into two sums in one query? Both is possible, the first can be done simply as SUM(col1 + col2), the second can be accomplished with two sums: sum(col1), sum(col2). Does that answer your question? Best regards, Jan
On Thu, Aug 16, 2012 at 4:28 PM, <[EMAIL PROTECTED]> wrote:
> Hello,**** > > ** ** > > Is there a way to aggregate multiple columns in Hive?**** > > I can do it in two separate queries but is there something similar to > sum(col1,col2)?**** > > ** ** > > Thanks,**** > > Richin**** >
+
Jan Dolinár 20120816, 16:06

RE: Aggregate Multiple Columns
richin.jain@... 20120816, 16:12
Thanks Jan,
I was looking for the first one, summing the values from two columns into one number. I did it as sum(col1) + sum(col2), but your solution is more elegant ☺
Regards, Richin
From: ext Jan Dolinár [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 16, 2012 12:07 PM To: [EMAIL PROTECTED] Subject: Re: Aggregate Multiple Columns
Hi Richin,
Do you mean summing the values from two columns into one number, or calculating sum of both columns into two sums in one query? Both is possible, the first can be done simply as SUM(col1 + col2), the second can be accomplished with two sums: sum(col1), sum(col2). Does that answer your question? Best regards, Jan On Thu, Aug 16, 2012 at 4:28 PM, <[EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]>> wrote: Hello,
Is there a way to aggregate multiple columns in Hive? I can do it in two separate queries but is there something similar to sum(col1,col2)?
Thanks, Richin
+
richin.jain@... 20120816, 16:12

