当前位置:   article > 正文

hive COALESCE 的使用_hive sql coalesce 结果不对

hive sql coalesce 结果不对

COALESCE(expr1, expr2, expr3)

当expr1为空时使用expr2为结果值,若expr2也为空,使用expr3为结果值

SELECT COALESCE (u.u_date, o.o_date, r.r_date, 'no_time') AS result_date, 
 COALESCE (u.na, o.na, r.na, 'no_netflow') AS result_na, 
 COALESCE (o.order_number, 0) AS on_order_num, COALESCE (o.total_price, 0) AS on_order_price, 
 COALESCE (r.order_num, 0) AS re_order_num, COALESCE (r.order_amount, 0) AS re_order_amount, 
 COALESCE (u.order_number, 0) AS un_order_num, 
 COALESCE (u.total_price, 0) AS un_total_price 
 FROM 
 underLine u FULL OUTER JOIN onLinePay o ON u.un_index = o.on_index FULL 
 OUTER JOIN refund r ON u.un_index = r.re_index;

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家小花儿/article/detail/973673
推荐阅读
相关标签
  

闽ICP备14008679号