select id, SUM(COALESCE(col1, 0))‍, SUM(COALESCE(col2, 0))‍, SUM(COALESCE(col3, 
0))‍, SUM(COALESCE(col4, 0)) from example group by id ‍




------------------ 原始邮件 ------------------
发件人: "usha hive";<ushah...@gmail.com>;
发送时间: 2014年6月25日(星期三) 凌晨4:23
收件人: "user"<user@hive.apache.org>; 

主题: Reg: Merging Rows



Hi,



 I am trying to merge few rows in to 1 row. I am stuck. Please help me.



 Example
id  col1      col2      col3        col4 
1   44       NULL    NULL    NULL
 1  NULL     37       NULL     NULL
1  NULL    NULL   88        NULL
1  NULL    NULL   NULL    99


to
 id  col1      col2      col3        col4 

1     44          37        88           99


Thanks,
Usha

Reply via email to