我在“借方”列中收到(null)
,为什么?
SELECT head_name, jv_acc_name, SUM (debit + credit) AS "Debit"
FROM voucher_detail
WHERE head_name IN (SELECT name_desc
FROM account_heads
WHERE acc_name = 'Assets')
GROUP BY head_name, jv_acc_name;
答案 0 :(得分:1)
尝试检查是否为空并分配0
SELECT head_name, jv_acc_name, SUM (nvl(debit,0) + nvl(credit,0)) AS "Debit"
FROM voucher_detail
WHERE head_name IN (SELECT name_desc
FROM account_heads
WHERE acc_name = 'Assets')
GROUP BY head_name, jv_acc_name;