【发布时间】:2021-02-26 00:47:54
【问题描述】:
我试图合并两个 last_record 值,但我收到一个空结果,尽管我知道其中一个值不为空。单独查询这些值时,会返回预期的非空值,但通过合并检查时我收到空值。
部分代码:
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)
我知道last_record 至少在两种情况之一中都不为空,尽管查询对这两种情况都返回空值。有什么想法可能是这里的问题吗?
【问题讨论】:
-
请清楚什么是
NULL,什么不是NULL。您的问题不清楚。