Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我对总是显示 null 的字段求和有问题,我已经尝试了所有这些 MySQL 查询,
(SUM(IFNULL(topup_amount,0))) AS total, SUM(topup_amount) AS total2, COALESCE(SUM(topup_amount),110), IFNULL(SUM(topup_amount), 0), COALESCE(SUM(topup_amount), 0)
但总是显示空结果,我需要 0(零)结果。有人知道吗?
检查我的所有查询后,问题是GROUP BY WEEK (topup_time)。我删除了这个,最后我得到了 ifnull 值。我不知道为什么会发生。