0
votes

I'm trying to coalesce between two last_record values but I'm receiving a null result despite knowing one of the values is non null. When querying these values alone, an expected non-null value is returned though when checked through coalesce I'm receiving null.

Portion of code:

select rds.*, 
    case when row_num=coalesce(bo.last_record, boa.last_record) 
        then closing - (rolling_debit - debit) else debit end Aged_Debt
    from rolling_debit_sum rds
    inner join balance_overflow bo
        on rds.client_number = bo.client_number
    inner join balance_overflow_aft boa
        on rds.client_number = boa.client_number
    where row_num >= coalesce(bo.last_record, boa.last_record)

I Know that last_record is not null in at leasat one of two cases, though the query returns null for both. Any ideas what might be the issue here?

1
Please be clear about what is and isn't NULL. Your question is unclear. - Gordon Linoff

1 Answers

0
votes

The issue was within the join. An outer join was required rather than inner.