我無法使用下面的查詢過濾出零字段。在「3年平均」或「比較用法」字段中有許多記錄的零點仍然包含在結果中。訪問條件不等於零
卸下「<> 0」或「不爲空」的標準沒有改變在輸出表中。訪問正在生成以下SQL:
SELECT
[active plant parts made from dept produced components usage].assembly_item_no,
[active plant parts made from dept produced components usage].component_item_no,
[active plant parts made from dept produced components usage].component_qty,
[active plant parts made from dept produced components usage].[3 yr average],
[active plant parts made from dept produced components usage].[comp usage],
noetix_sys_invus_category_all.[a$cat$item_type]
INTO [department component usage and assembly type]
FROM [active plant parts made from dept produced components usage]
INNER JOIN noetix_sys_invus_category_all
ON
[active plant parts made from dept produced components usage].assembly_item_no =
noetix_sys_invus_category_all.[a$item$item_number]
WHERE (((
[active plant parts made from dept produced components usage].[3 yr average]
)
<> 0)
AND ((
[active plant parts made from dept produced components usage].[comp usage])
<> 0)
AND ((noetix_sys_invus_category_all. [a$cat$item_type]) = "aft"))
OR (((
[active plant parts made from dept produced components usage].[3 yr average]
)
IS NOT NULL)
AND ((
[active plant parts made from dept produced components usage].[comp usage]
)
IS NOT NULL)
AND ((noetix_sys_invus_category_all.[a$cat$item_type]) = "aft+"))
OR (((noetix_sys_invus_category_all.[a$cat$item_type]) = "oem"))
OR (((noetix_sys_invus_category_all.[a$cat$item_type]) = "oem+"))
ORDER BY
[active plant parts made from dept produced components usage].[3 yr average] DESC,
[active plant parts made from dept produced components usage].[comp usage] DESC,
noetix_sys_invus_category_all.[a$cat$item_type];
感謝您的幫助。
IsNull在Access中不能像那樣工作,您需要使用Nz(Expression,0) – Minty
我知道......在[Thursday](https://stackoverflow.com/questions/45222393/)上使用它sql-code-efficiency-compiling-issues-with-microsoft-access#comment77411148_45222393)...只是不玩w/access足以記住..謝謝你。我只是希望coalesce得到支持。這是我的defactor更改null爲大多數引擎。以及當不... – xQbert
另請注意:由於這是一個create table語句,所以order by是不必要的;只是吃時間。從創建的表中選擇應該有按順序。插入的順序並不能真正幫助任何事情。 – xQbert