我尝试创建一个插入一些公式的查询,但如果公式中涉及的单元格中有任何NULL
,则该结果没有结果。我尝试将NULL
替换为0
(无需显示数字0
,只需要一个值,以便公式可以使用)SELECT IIF(ISNULL([field]), 0, [field]) FROM [table]
,但我不要&# 39;知道如何在SQL视图中正确编写它。这是整个SQL代码:
SELECT [LISTING MASTER].Broker, [LISTING MASTER].Type,
[LISTING MASTER].[TransID], [LISTING MASTER].ACTIVE,
[LISTING MASTER].[CANCELLED - CLIENT], [LISTING MASTER].[CANCELLED - TEAM],
[LISTING MASTER].EXPIRED, [LISTING MASTER].[OFF MARKET],
[LISTING MASTER].PENDING, [LISTING MASTER].[SOLD - EXTERNAL],
[LISTING MASTER].[SOLD - INTERNAL], [LISTING MASTER].UNSIGNED,
[ACTIVE]/[TransID] AS active1, [CANCELLED - CLIENT]/([TransID]-[ACTIVE]) AS CC2,
[CANCELLED - TEAM]/([TransID]-[ACTIVE]) AS CT3, [EXPIRED]/([TransID]-[ACTIVE]) AS expired4
FROM [LISTING MASTER];
如何将所有NULL
更改为0
?更具体地说,我需要[ACTIVE]/[TransID] AS active1, [CANCELLED - CLIENT]/([TransID]-[ACTIVE]) AS CC2, [CANCELLED - TEAM]/([TransID]-[ACTIVE]) AS CT3, [EXPIRED]/([TransID]-[ACTIVE]) AS expired4
这一部分有效。
如果有人可以修复它并粘贴整个代码,以便我可以将其粘贴到我的SQL视图中,那将非常感谢!我几乎不知道编码...非常感谢。