Hive outer join: how to change the default NULL value
You can use COALESCE
for this, instead of solely Table2.txn_amt
COALESCE(Table2.txn_amt, 0.0)
What this does is returns the first value that is not null. So, if txn_amt
is null, it'll go to the second value in the list. 0.0
is never null, so it'll pick that. If txn_amt
has a value in it, it'll return that value.